Zimlet JavaScript API Reference - AjxColor

Class AjxColor


This class represents a color and is useful for color operations inspired by the code in SkinResources.java.

Defined in: AjxColor.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
AjxColor(r, g, b)
Creates a color object.
Method Summary
Method Attributes Method Name and Description
<static>  
AjxColor.color(r, g, b)
Returns a color string of the form "#rrggbb" from the given color components.
<static>  
AjxColor.components(color)
Returns the RGB components (as an array) of the given color.
<static>  
AjxColor.darken(color, delta)
Darkens the specified color by the given amount.
<static>  
AjxColor.deepen(color, adjustment)
Deepens the specified color.
<static>  
AjxColor.lighten(color, delta)
Lightens the specified color by the given amount.
 
Returns a string representation of the object.
Class Detail
AjxColor(r, g, b)
Creates a color object.
Parameters:
r
g
b
Method Detail
<static> {string} AjxColor.color(r, g, b)
Returns a color string of the form "#rrggbb" from the given color components.
Parameters:
{number} r
the Red component value between 0 and 255, inclusive
{number} g
the Green component value between 0 and 255, inclusive
{number} b
the Blue component value between 0 and 255, inclusive
Returns:
{string} the color string

<static> {array} AjxColor.components(color)
Returns the RGB components (as an array) of the given color.
Parameters:
{string} color
the color string defined as "#rrggbb"
Returns:
{array} the color

<static> {string} AjxColor.darken(color, delta)
Darkens the specified color by the given amount.
Parameters:
{string} color
the color value defined as "#rrggbb"
{number} delta
the amount to change
Returns:
{string} the color string

<static> {string} AjxColor.deepen(color, adjustment)
Deepens the specified color. This operation is different than darken because it retains the brightness of the color even when it gets darker. Just making a color darker tends to result in a color that is "muddy".

The color is deepened by first determining the largest individual component value and then multiplying each component value by the ratio of its value to the largest value. Then, optionally, each value is multiplied by the adjustment value in order to deepen a little more or a little less. Typical adjustment values are around 1 such as .9 or 1.1.

Parameters:
{string} color
the color value defined as "#rrggbb"
{number} adjustment Optional
the multiplier adjustment
Returns:
{string} the color string

<static> {string} AjxColor.lighten(color, delta)
Lightens the specified color by the given amount.
Parameters:
{string} color
the color value defined as "#rrggbb"
{number} delta
the amount to change
Returns:
{string} the color string

{string} toString()
Returns a string representation of the object.
Returns:
{string} a string representation of the object

Documentation generated by JsDoc Toolkit 2.3.0 on Tue Jun 28 2016 21:01:25 GMT-0400 (EDT)