Class kh.color.RGB
Defined in: kh-color.js.
Constructor Attributes | Constructor Name and Description |
---|---|
kh.color.RGB(r, g, b)
r, g, b Integer in [0, 255]
|
Field Attributes | Field Name and Description |
---|---|
the blue value of the color in [0, 255]
|
|
the green value of the color in [0, 255]
|
|
the intensity of the color, like in YUV
|
|
Indicate if the current color is websafe,
http://en.wikipedia.org/wiki/Web_colors#Web-safe_colors
|
|
the red value of the color in [0, 255]
|
Method Attributes | Method Name and Description |
---|---|
<private> |
hex(n)
convert a integer in hexadecimal (should be < 256)
|
toHEXA(threedigit, sharp)
Hexadecimal representation
|
|
toHSL()
HSL conversion
|
|
toHSV()
HSV conversion
|
|
toString()
String conversion
|
|
Returns the nearest color that is websafe,
http://en.wikipedia.org/wiki/Web_colors#Web-safe_colors
|
|
websafeInt(n)
returns the integer nearest the value that be used in the short HTML
representation (like in #fff)
|
Field Detail
b
the blue value of the color in [0, 255]
g
the green value of the color in [0, 255]
{Float}
intensity
the intensity of the color, like in YUV
{Boolean}
isWebSafe
Indicate if the current color is websafe,
http://en.wikipedia.org/wiki/Web_colors#Web-safe_colors
r
the red value of the color in [0, 255]
Method Detail
<private>
{String}
hex(n)
convert a integer in hexadecimal (should be < 256)
- Parameters:
- {Integer} n
- Returns:
- {String}
{String}
toHEXA(threedigit, sharp)
Hexadecimal representation
- Parameters:
- {Boolean} threedigit
- - return short representation (3 digits, ex: #fff) if possible (default = false)
- {Boolean} sharp
- - return a # as first character (default = false)
- Returns:
- {String}
{HSL}
toHSL()
HSL conversion
- Returns:
- {HSL} object
{HSV}
toHSV()
HSV conversion
- Returns:
- {HSV} object
{String}
toString()
String conversion
- Returns:
- {String}
{RGB}
toWebSafe()
Returns the nearest color that is websafe,
http://en.wikipedia.org/wiki/Web_colors#Web-safe_colors
- Returns:
- {RGB} object
{Integer}
websafeInt(n)
returns the integer nearest the value that be used in the short HTML
representation (like in #fff)
- Parameters:
- {Integer} n
- Returns:
- {Integer}