color-effects
v1.1.0
Published
A javascript class to generate color effects
Downloads
4
Maintainers
Readme
Color Effects
This library contains a javascript class. The class provides several color effect generations and provides always an array with colors, whereby the color itself is an array containing a red, green and blue value.
Precondition
The library is implemented in ECMAScript 2015, so your project should support at least this version.
Installation
Install it via npm:
$ npm install color-effects
Usage
Start with importing the module via:
var ColorEffects = require('color-effects')
Create an instance providing the number of pixels (lights, leds). This will be the number of colors in the returned array of each effect method.
// 32 pixels
var effects = new ColorEffects(32)
Supported Effects
Rainbow
Generate a rainbow:
// generated array starts with red and ends with violet
var rainbow = effects.rainbow()
// reversed rainbow (from violet to red)
var rainbowReverse = effects.rainbow(true)
Fade
Generate a color gradient from a color to another color:
// from red to blue
var colors = effects.fade('#ff0000', 'rgb(0, 0, 255)')
Random
Generate a collection of random colors:
var chaos = effects.random()
API
Check out the documentation for details.
License
MIT