rgb2ryb

[DEPRECATED] Convert colors in JavaScript from rgb to ryb and back

npm install rgb2ryb
21 downloads in the last month

rgb2ryb

Convert colors in JavaScript from rgb to ryb and back

DEPRECATION NOTICE

The calculations presented here are not accurate, this module has been deprecated in favor of ryb2rgb (npm install ryb2rgb)

Example

rgb2ryb

var rgb2ryb = require('../rgb2ryb'),
console.log(rgb2ryb([0, 255, 0]));

yields

[0, 255, 255]

ryb2rgb

var rgb2ryb = require('../rgb2ryb'),
console.log(rgb2ryb.ryb2rgb([0, 255, 0]));

yields

[255, 255, 0]

complimentary

var rgb2ryb = require('../rgb2ryb'),
console.log(rgb2ryb.complimentary([0, 255, 0]));

yields

[255, 0, 255]

Functions

These functions are available in Node and in the browser

  • color: an array of rgb/ryb values. ie [0, 255, 255]

rgb2ryb(color)

Convert from rgb to ryb

ryb2rgb(color)

Convert from ryb to rgb

complimentary(color, [limit])

Easily calculate a colors complimentary, limit defaults to 255

Usage

var rgb2ryb = require('rgb2ryb');

or

<script src="rgb2ryb.js"></script>

Installation

npm install rgb2ryb

Credits

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

License

MIT

npm loves you