goog.color
Functions
Blend two colors together, using the specified factor to indicate the weight given to the first color
Parameters |
| ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
|
Adds black to the specified color, darkening it
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
hexToRgbStyle( hexColor ) → string
string
Find the "best" (highest-contrast) of the suggested colors for the prime color. Uses W3C formula for judging readability and visual accessibility: http://www.w3.org/TR/AERT#color-contrast
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
hslArrayToHex( hsl ) → string
string
hslDistance( hsl1, hsl2 ) → number
number
Calculates the Euclidean distance between two color vectors on an HSL sphere. A demo of the sphere can be found at: http://en.wikipedia.org/wiki/HSL_color_space In short, a vector for color (H, S, L) in this system can be expressed as (SL'cos(2PIH), SL'sin(2PIH), L), where L' = abs(L - 0.5), and we simply calculate the 1-2 distance using these coordinates
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
hslToHex( h, s, l ) → string
string
hsvArrayToHex( hsv ) → string
string
hsvToHex( h, s, v ) → string
string
isValidColor( str ) → boolean
boolean
Adds white to the specified color, lightening it
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
normalizeHex( hexColor ) → string
string
prependHashIfNecessaryHelper( str ) → string
string
prependZeroIfNecessaryHelper( hex ) → string
string
rgbArrayToHex( rgb ) → string
string
rgbToHex( r, g, b ) → string
string
Properties
HSL color representation. An array containing three elements [h, s, l]: h (hue) must be an integer in [0, 360], cyclic. s (saturation) must be a number in [0, 1]. l (lightness) must be a number in [0, 1].
HSV color representation. An array containing three elements [h, s, v]: h (hue) must be an integer in [0, 360], cyclic. s (saturation) must be a number in [0, 1]. v (value/brightness) must be an integer in [0, 255].
RGB color representation. An array containing three elements [r, g, b], each an integer in [0, 255], representing the red, green, and blue components of the color respectively.
A map that contains a lot of colors that are recognised by various browsers. This list is way larger than the minimal one dictated by W3C. The keys of this map are the lowercase "readable" names of the colors, while the values are the "hex" values.