New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@lgv/pattern-hexagon

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lgv/pattern-hexagon

ES6 svg hexagon pattern.

latest
Source
npmnpm
Version
0.0.4
Version published
Weekly downloads
1
-50%
Maintainers
1
Weekly downloads
 
Created
Source

Pattern Hexagon

ES6 svg hexagon pattern.

Environment Variables

The following values can be set via environment or passed into the class.

NameTypeDescription
DIMENSION_UNITintegerwidth/height of single pattern swatch

Install

# install package
npm install @lgv/pattern-hexagon

HexagonPattern

Use Module

import { HexagonPattern } from "@lgv/pattern-hexagon";

// initialize
const hp = new HexagonPattern();

// generate svg artboard
let artboard = document.createElementNS("http://www.w3.org/2000/svg", "svg");
artboard.setAttributeNS(null, "id", "artboard");
artboard.setAttributeNS(null, "width", 100);
artboard.setAttributeNS(null, "height", 100);
document.body.appendChild(artboard);

// generate pattern in svg
hp.generate(artboard, "my-pattern");

Use Pattern in CSS

// style the hexagons
#my-pattern polygon {

    fill: red;
    stroke: blue;

}

// use pattern as fill on other elements
.some-class {

    fill: url(#my-pattern);

}

Use Pattern in JavaScript

// assume the svg element already exists (let artboard) from above code for using the module

// generate svg shape
let rectangle = document.createElementNS("http://www.w3.org/2000/svg", "rect");
rectangle.setAttributeNS(null, "x", 0);
rectangle.setAttributeNS(null, "y", 0);
rectangle.setAttributeNS(null, "width", 50);
rectangle.setAttributeNS(null, "height", 50);
rectangle.setAttributeNS(null, "fill", "url(#my-pattern)");
artboard.appendChild(rectangle);

Keywords

pattern

FAQs

Package last updated on 12 Sep 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts