Color Utils
Usage
API
Class XYZ extends abstract class aColor
Constructor
new XYZ(int x, int y, int z);
Example usage:
var color = new XYZ(100,66,22);
Properties
-
(int) x
Current x value of the color
-
(int) y
Current y value of the color
-
(int) z
Current z value of the color
Methods
(Hex) toHex()
Returns a new Hex object based on the current colors data
(RGB) toRGB()
Returns a new RGB object based on the current colors data
(XYZ) toXYZ()
Returns a new XYZ object based on the current colors data
(CIELab) toCIELab()
Returns a new CIELab object based on the current colors data
(CIELCh) toCIELCh()
Returns a new CIELCh object based on the current colors data
(CMY) toCMY()
Returns a new CMY object based on the current colors data
(CMYK) toCMYK()
Returns a new CMYK object based on the current colors data
(HSV) toHSV()
Returns a new HSV object based on the current colors data
(int) distance(aColor destinationColor)
Find the distance from one color to another based on Delta E*
var distance = mycolor.distance(new Hex("00cc00"));(aColor) websafe()
Find the closest websafe color to your current color
var mywebsafecolor = mycolor.websafe();(aColor) match(Array[aColor] palette)
Match your color to the nearest from a palette of colors
var matched = mycolor.match([ new Hex("00cc00"), new RGB(44,100,255), new Hex("11FDFD"), new Hex("000000"), new Hex("0000FF") ]);(Array[aColor]) equal(int parts, include bool)
Get colors at equal distances around the color wheel, starting from your current color
var equal = mycolor.equal(10,true); for (var i=0; i<equal.length; i++){ document.write(equal[i] + '<br />'); }(Array[aColor]) split(bool include)
Find the two colors 150 degrees (hue) either side of your current color
var split = mycolor.split(); for (var i=0; i<split.length; i++){ document.write(split[i] + '<br />'); }(Array[aColor]) analogous(bool include)
Find the two colors 30 degrees (hue) either side of your current color
var analogous = mycolor.analogous(); for (var i=0; i<analogous.length; i++){ document.write(analogous[i] + '<br />'); }(Array[aColor]) rectangle(int sidelength, bool include)
Find an array of colors based upon drawing a rectangle on the color wheel where the starting point is your current color
var rectangle = mycolor.rectangle(20); for (var i=0; i<rectangle.length; i++){ document.write(rectangle[i] + '<br />'); }(Array[aColor]) range(aColor destinationColor, int steps, bool include)
Find an equally spaced list of colors between your current color and another color
var range = mycolor.range(new Hex("0000CC"), 10, true); for (var i=0; i<range.length; i++){ document.write(range[i] + '<br />'); }(aColor) greyscale()
Get a greyscale representation of your current color
var mygreyscale = mycolor.greyscale();(aColor) hue(int hueModifier)
Increase or decrease the current colors hue.
var mynewcolor = mycolor.hue(-20);(aColor) saturation(int saturationModifier)
Increase or decrease the current colors saturation.
var mynewcolor = mycolor.saturation(-30);(aColor) brightness(int brightnessModifier)
Increase or decrease the current colors brightness.
var mynewcolor = mycolor.brightness(20);