Install this version via npm:
npm install rainbow.js
And use in your node source:
var Rainbow = require('rainbow.js');
Supported colors schemas are:
- RGB ( Red Green Blue )
- hex RGB
- HSV ( Hue Saturation Brightness )
- CMYK ( Cyan Magenta Yellow Key black )
Examples of use:
RGB to HSV:
var test = new Rainbow({ r: 255, g: 255, b: 255 });
console.log( test.hsv );
> { h: 0, s: 0, v: 100 }
HSV to RGB:
var test = new Rainbow({ h: 0, s: 0, v: 100 });
console.log( test.rgb );
> { r: 255, g: 255, b: 255 }
RGB to hex:
var test = new Rainbow({ r: 255, g: 255, b: 255 });
console.log( test.hex );
> 'ffffff'
hex to RGB:
var test = new Rainbow('ffffff');
console.log( test.rgb );
> { r: 255, g: 255, b: 255 }
RGB to CMYK:
var test = new Rainbow({ r: 255, g: 255, b: 255 });
console.log( test.cmyk );
> { c: 0, m: 0, y: 0, k: 0 }
CMYK to RGB:
var test = new Rainbow({ c: 0, m: 0, y: 0, k: 0 });
console.log( test.rgb );
> { r: 255, g: 255, b: 255 }
Rainbow is released under the GNU General Public License (GPL3): Copyright (C) 2012 jiin
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL-3.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.