![]()
Blend two colors together, using the specified factor to indicate the weight
given to the first color
Arguments:
Returns: !goog.color.Rgb
Combined color represented in rgb.
|
code » | ||||
Calculate color difference between two colors. Helper method for
goog.color.highContrast()
Arguments:
Returns: number
Color difference.
|
code » | ||||
![]()
Adds black to the specified color, darkening it
Arguments:
Returns: !goog.color.Rgb
Combined rgb color.
|
code » | ||||
![]()
Converts a hex representation of a color to HSL.
Arguments:
Returns: !goog.color.Hsv
hsv representation of the color.
|
code » | ||||
![]()
Converts a hex representation of a color to HSV
Arguments:
Returns: !goog.color.Hsv
hsv representation of the color.
|
code » | ||||
![]()
Converts a hex representation of a color to RGB.
Arguments:
Returns: !goog.color.Rgb
rgb representation of the color.
|
code » | ||||
Converts a hex representation of a color to RGB.
|
code » | ||||
![]()
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
Arguments:
Returns: !goog.color.Rgb
Highest-contrast color represented by an array..
|
code » | ||||
Converts from an hsl array to a hex string
Arguments:
Returns: string
hex representation of the color.
|
code » | ||||
![]()
Converts a color from HSL color space to RGB color space.
Arguments:
Returns: !goog.color.Rgb
rgb representation of the color.
|
code » | ||||
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
(S*L'*cos(2*PI*H), S*L'*sin(2*PI*H), L), where L' = abs(L - 0.5), and we
simply calculate the 1-2 distance using these coordinates
Arguments:
Returns: number
Distance between the two colors, in the range [0, 1].
|
code » | ||||
Converts from h,s,l values to a hex string
|
code » | ||||
![]()
Converts a color from HSL color space to RGB color space.
Modified from
http://www.easyrgb.com/math.html
|
code » | ||||
Converts from an HSV array to a hex string
Arguments:
Returns: string
hex representation of the color.
|
code » | ||||
![]()
Converts an HSV triplet to an RGB array.
Arguments:
Returns: !goog.color.Rgb
rgb representation of the color.
|
code » | ||||
Converts from h,s,v values to a hex string
|
code » | ||||
![]()
Converts an HSV triplet to an RGB array. V is brightness because b is
reserved for blue in RGB.
|
code » | ||||
Helper for hslToRgb.
|
code » | ||||
Checks if a string is a normalized hex color.
We expect strings of the format #RRGGBB (ex: #1b3d5f)
using only lowercase letters.
|
code » | ||||
Determines if the given string can be parsed as a color.
.
|
code » | ||||
Checks if a string is a valid hex color. We expect strings of the format
#RRGGBB (ex: #1b3d5f) or #RGB (ex: #3CA == #33CCAA).
|
code » | ||||
![]()
Checks if a string is a valid rgb color. We expect strings of the format
'(r, g, b)', or 'rgb(r, g, b)', where each color component is an int in
[0, 255].
Arguments:
Returns: !goog.color.Rgb
the rgb representation of the color if it is
a valid color, or the empty array otherwise.
|
code » | ||||
![]()
Adds white to the specified color, lightening it
Arguments:
Returns: !goog.color.Rgb
Combined rgb color.
|
code » | ||||
Normalize an hex representation of a color
|
code » | ||||
![]()
Parses a color out of a string.
Arguments:
Returns: {hex: string, type: string
} 'hex' is a string containing a hex
representation of the color, 'type' is a string containing the type
of color format passed in ('hex', 'rgb', 'named').
|
code » | ||||
![]()
Parses red, green, blue components out of a valid rgb color string.
Throws Error if the color string is invalid.
Arguments:
Returns: !goog.color.Rgb
rgb representation of the color.
|
code » | ||||
Takes a string a prepends a '#' sign if one doesn't exist.
Small helper method for use by goog.color and friends.
|
code » | ||||
Takes a hex value and prepends a zero if it's a single digit.
Small helper method for use by goog.color and friends.
|
code » | ||||
Converts a color from RGB to hex representation.
Arguments:
Returns: string
hex representation of the color.
|
code » | ||||
![]()
Converts a color from RGB color space to HSL color space.
Arguments:
Returns: !goog.color.Hsl
hsl representation of the color.
|
code » | ||||
![]()
Converts from an array of RGB values to an array of HSV values.
Arguments:
Returns: !goog.color.Hsv
hsv representation of the color.
|
code » | ||||
Takes an array of [r, g, b] and converts it into a string appropriate for
CSS styles.
Arguments:
Returns: string
string of the form 'rgb(r,g,b)'.
|
code » | ||||
Converts a color from RGB to hex representation.
|
code » | ||||
![]()
Converts a color from RGB color space to HSL color space.
Modified from
http://en.wikipedia.org/wiki/HLS_color_space .
|
code » | ||||
![]()
Converts from RGB values to an array of HSV values.
|
code » | ||||
Calculate difference in brightness of two colors. Helper method for
goog.color.highContrast()
Arguments:
Returns: number
Brightness difference.
|
code » | ||||
Calculate brightness of a color according to YIQ formula (brightness is Y).
More info on YIQ here: http://en.wikipedia.org/wiki/YIQ. Helper method for
goog.color.highContrast()
Arguments:
Returns: number
brightness (Y).
|
code » |
![]()
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].
|
Code » | |
![]()
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].
|
Code » | |
![]()
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.
|
Code » | |
![]()
No description.
|
Code » | |
![]()
No description.
|
Code » | |
![]()
Regular expression for extracting the digits in a hex color triplet.
|
Code » | |
![]()
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.
|
Code » | |
![]()
Helper for isNormalizedHexColor_.
|
Code » | |
![]()
Regular expression for matching and capturing RGB style strings. Helper for
isValidRgbColor_.
|
Code » | |
![]()
Helper for isValidHexColor_.
|
Code » |