CGSGColor Class
Some utils methods extending the Array prototype
Item Index
Methods
_toHex
(
String
private
-
n
Parameters:
-
nStringString or Number representation of a number between 0 and 255
Returns:
String:
Example "A6"
hex2rgb
(
Object
static
-
hex
Convert an hexadecimal code for color to R, G and B
Parameters:
-
hexStringan hexadecimal code, with or without the starting sharp (#)
Returns:
Object:
an object encapsulating r, g and b values (from 0 to 255)
hsl2rgb
(
Object
-
h -
s -
l
HSL to RGB converter. Adapted from http://en.wikipedia.org/wiki/HSLcolorspace
Returns:
Object:
A {r, g, b} object
hsv2rgb
(
Object
-
h -
s -
v
HSV to RGB converter. Adapted from http://en.wikipedia.org/wiki/HSVcolorspace
Returns:
Object:
A {r, g, b} object
lerp
(
String
static
-
colorFrom -
colorTo -
weight
Linear interpolation between 2 colors
Returns:
String:
a heh value for the interpolated color
rgb2hex
(
String
static
-
r -
g -
b
Convert R, G and B value to an hexadecimal code
Parameters:
Returns:
String:
an hexadecimal value for the color, starting with a sharp (#)
rgb2hsl
(
Object
-
r -
g -
b
RGB to HSL converter. Adapted from http://en.wikipedia.org/wiki/HSLcolorspace
Returns: