the compact javascript framework
in partnership with mediatemple
Contains the Color class.
MIT-style license.
Color.js | Contains the Color class. |
Color | Creates a new Color Object, which is an array with some color specific methods. |
Properties | |
mix | Mixes two or more colors with the Color. |
invert | Inverts the Color. |
setHue | Modifies the hue of the Color, and returns a new one. |
setSaturation | Changes the saturation of the Color, and returns a new one. |
setBrightness | Changes the brightness of the Color, and returns a new one. |
Utility Functions | |
Functions | |
$RGB | Shortcut to create a new color, based on red, green, blue values. |
$HSB | Shortcut to create a new color, based on hue, saturation, brightness values. |
Array | A collection of The Array Object prototype methods. |
Properties | |
rgbToHsb | Converts a RGB array to an HSB array. |
hsbToRgb | Converts an HSB array to an RGB array. |
Creates a new Color Object, which is an array with some color specific methods. Arguments: color - the hex, the RGB array or the HSB array of the color to create. For HSB colors, you need to specify the second argument. type - a string representing the type of the color to create. needs to be specified if you intend to create the color with HSB values, or an array of HEX values. Can be ‘rgb’, ‘hsb’ or ‘hex’.
var black = new Color('#000'); var purple = new Color([255,0,255]); // mix black with white and purple, each time at 10% of the new color var darkpurple = black.mix('#fff', purple, 10); $('myDiv').setStyle('background-color', darkpurple);
Properties | |
mix | Mixes two or more colors with the Color. |
invert | Inverts the Color. |
setHue | Modifies the hue of the Color, and returns a new one. |
setSaturation | Changes the saturation of the Color, and returns a new one. |
setBrightness | Changes the brightness of the Color, and returns a new one. |
Mixes two or more colors with the Color.
color | a color to mix. you can use as arguments how many colors as you want to mix with the original one. |
alpha | if you use a number as the last argument, it will be threated as the amount of the color to mix. |
Changes the saturation of the Color, and returns a new one.
percent | the percentage of the saturation to set |
Changes the brightness of the Color, and returns a new one.
percent | the percentage of the brightness to set |
Shortcut to create a new color, based on red, green, blue values.
r | (integer) red value (0-255) |
g | (integer) green value (0-255) |
b | (integer) blue value (0-255) |
Shortcut to create a new color, based on hue, saturation, brightness values.
h | (integer) hue value (0-100) |
s | (integer) saturation value (0-100) |
b | (integer) brightness value (0-100) |
A collection of The Array Object prototype methods.
Properties | |
rgbToHsb | Converts a RGB array to an HSB array. |
hsbToRgb | Converts an HSB array to an RGB array. |
Shortcut to create a new color, based on red, green, blue values.
Shortcut to create a new color, based on hue, saturation, brightness values.
Documentation by Aaron Newton & Mootools Developers, generated by NaturalDocs and GeSHi