Convert colors in JavaScript from rgb to ryb and back
The calculations presented here are not accurate, this module has been deprecated
in favor of ryb2rgb (npm install ryb2rgb
)
var rgb2ryb = require('../rgb2ryb'),
console.log(rgb2ryb([0, 255, 0]));
yields
[0, 255, 255]
var rgb2ryb = require('../rgb2ryb'),
console.log(rgb2ryb.ryb2rgb([0, 255, 0]));
yields
[255, 255, 0]
var rgb2ryb = require('../rgb2ryb'),
console.log(rgb2ryb.complimentary([0, 255, 0]));
yields
[255, 0, 255]
These functions are available in Node and in the browser
color
: an array of rgb/ryb values. ie[0, 255, 255]
Convert from rgb to ryb
Convert from ryb to rgb
Easily calculate a colors complimentary, limit defaults to 255
var rgb2ryb = require('rgb2ryb');
or
<script src="rgb2ryb.js"></script>
npm install rgb2ryb
Original code http://www.insanit.net/computer-programming/red-green-blue-to-red-yellow-blue-part-2/
Ported to JS for node and the browser
MIT