1 | # `hero-patterns.js`
|
2 |
|
3 | Easily set background images from [Hero Patterns](http://heropatterns.com) with JavaScript.
|
4 |
|
5 | Each pattern from [Hero Patterns](http://heropatterns.com) has its own function. Each function returns the SVG data as a string wrapped in a `url()` function. The functions take two parameters: one for setting the fill color, the other for setting the fill opacity.
|
6 |
|
7 | # Usage
|
8 |
|
9 | ### Install
|
10 |
|
11 | ```js
|
12 | npm install --save hero-patterns
|
13 | ```
|
14 |
|
15 | ### Set `background-image` to "Tic Tac Toe" pattern
|
16 |
|
17 | ```js
|
18 | import {ticTacToe} from 'hero-patterns'
|
19 |
|
20 | let el = document.querySelector('header')
|
21 | el.style.backgroundImage = ticTacToe('red', 0.9)
|
22 |
|
\ | No newline at end of file |