Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

hero-patterns

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hero-patterns - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

3

package.json
{
"name": "hero-patterns",
"version": "1.1.0",
"version": "1.2.0",
"description": "Patterns from heropatterns.com exported as ES6 functions",

@@ -45,2 +45,3 @@ "main": "hero-patterns.js",

"random-a11y-combo": "^1.0.0",
"randomcolor": "^0.4.4",
"rollup": "^0.41.6",

@@ -47,0 +48,0 @@ "rollup-plugin-alias": "^1.2.1",

export let defaultFill = '#000000'
export let defaultOpacity = '0.8'
export let defaultOpacity = 1

@@ -11,4 +11,4 @@ # `hero-patterns.js`

```js
npm install --save hero-patterns
```sh
yarn add hero-patterns
```

@@ -23,1 +23,19 @@

el.style.backgroundImage = ticTacToe('red', 0.9)
```
### Set multiple backgrounds
```js
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, see [the code I used to generate the previews on the demo page](./site/main.js).

@@ -8,2 +8,3 @@ import resolve from 'rollup-plugin-node-resolve'

import fs from 'fs-extra'
import randomColor from 'randomcolor'
import combo from 'random-a11y-combo'

@@ -27,6 +28,7 @@ import * as hero from './hero-patterns'

let num = process.env.NODE_ENV === 'production' ? Object.keys(hero).length * 10 : 69
for (let i = num; i--;) {
combos.push(combo())
let colors = randomColor({ count: num })
for (let color of colors) {
combos.push(combo(color))
}
fs.outputJsonSync('./dist/combos.json', combos)
fs.outputJsonSync('./dist/colors.json', combos)

@@ -38,3 +40,3 @@ // OK now on to the actual Rollup stuff

resolve: ['.js', '.json'],
combos: './../dist/combos',
colors: './../dist/colors',
'package.json': './../package',

@@ -41,0 +43,0 @@ 'hero-patterns': './../hero-patterns'

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc