Convert colors in JavaScript from rgb to ryb and back
Switch branches/tags
Nothing to show
Clone or download
Latest commit e08e4f9 Mar 1, 2013
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples Initial commit Sep 28, 2012
README.md docs Mar 2, 2013
package.json bump Mar 2, 2013
rgb2ryb.js Update rgb2ryb.js Feb 15, 2013

README.md

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