color-rainbow
Easily generate rainbow colors.
npm install color-rainbow
Example
var Rainbow = ; var numColors = 100;var rainbowColors = Rainbow; var html = '';for var i = 0; i < numColors; ++i var color = rainbowColorsi html += '<div style:"background-color:"' + color + '"/>';
This generated the image above. (Source)
Docs
Note: All colors are stored using color.
Rainbow.create(numberOfColors)
Gets a list of colors that creates a full rainbow cycle (red to red).
numberOfColors
: The number of colors that make up a full rainbow cycle.
var Rainbow = ; var colors = Rainbow; for var i = 0; i < colorslength; ++i console;
new Rainbow(numberOfColors)
Creates a new rainbow object. This is useful when we want to store individual states of a rainbow and get the next color in the rainbow on demand.
numberOfColors
: The number of colors that make up a full rainbow cycle.
.next()
Gets the next color of the rainbow wave
var Rainbow = ; var myRainbow = 6; var red = myRainbownextvar orange = myRainbownextvar yellow = myRainbownextvar green = myRainbownextvar blue = myRainbownextvar purple = myRainbownext// The next myRainbow.next() would be red
Testing
Run npm test
.