svg-patterns

Create SVG patterns programmatically to visualize data.

D3 is not required. 5k minified & gzipped.

See the docs for more details.

// npm install svg-patterns

const patterns = require('svg-patterns')
const stringify = require('virtual-dom-stringify')

const pattern = patterns.lines({
	stroke: 'darkorange',
	background: '#343434'
})

process.stdout.write(`
	<svg xmlns="http://www.w3.org/2000/svg">
		<defs>${stringify(pattern)}</defs>
		<rect width="200" height="200" style="fill: ${pattern.url()}"/>
	</svg>
`)