Installation

npm install hero-patterns

Usage

import * as hero from 'hero-patterns'

// set fill & opacity
document.querySelector('.tech').style.backgroundImage = hero.circuitBoard('#bada55', 0.5)

// // set fill with full opacity
document.querySelector('.milkshake').style.backgroundImage = hero.iLikeFood('#c0ff33')

// use default fill (#000) & opacity (1)
document.querySelector('.dark-side').style.backgroundImage = hero.deathStar()

For (slightly) more advanced usage, you can see the code I used to generate the previews above.