color-effects

1.1.0 • Public • Published

Color Effects

Codacy Badge Coverage Status npm npm npm

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.1.0
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.1.0
    2
  • 1.0.0
    0

Package Sidebar

Install

npm i color-effects

Weekly Downloads

2

Version

1.1.0

License

MIT

Unpacked Size

1.04 MB

Total Files

38

Last publish

Collaborators

  • vertumnus