Skip to content

zhuber/donatello-svg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

Procedural SVG generator npm version

Procedural SVG

Overview

Automatically generate SVG assets with random paths, shapes and fill colors.

Options (all are optional)

  • Width
  • Height
  • Colors (array of hex colors, or empty array for no fill, ex: [])
  • Complexity (defaults to 'basic', but can also be set to 'complex')

Usage

Javascript

import generateSVG from 'donatello-svg';

const basicSVG = generateSVG(28, 28);
const specificColorSVG = generateSVG(28, 28, ['#cc66aa', '#ffeeff']);
const complexSVG = generateSVG(28, 28, ['#bbaa88', '#33eeff', '#ccaaee'], 'complex');

...
<div>
  {basicSVG} // Note: This is output as a string and you may need to massage the output depending on where you attempt to render it.
</div>

React

import generateSVG from 'donatello-svg';
import InlineSVG from 'svg-inline-react'; // Note: This is required in many cases to output inline SVGs.

const specificColorSVG = generateSVG(28, 28, ['#cc66aa', '#33eeff']);

...
<div>
  <InlineSVG src={specificColorSVG} />
</div>

About

Procedural SVG generator for node.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published