Class Index | File Index | UML

Classes


Class one.color.HSL


UML

A color in the HSL colorspace, with an optional alpha value.

one.color.(RGB|HSL|HSV|CMYK) objects are designed to be immutable; all the conversion, set, and adjust methods return new objects.

one.color.(RGB|HSL|HSV|CMYK) objects automatically get the set and adjust methods from all other installed colorspaces, so although you can use the explicit conversion methods ({@link one.color.HSL#toRGB}, one.color.HSL#toHSV...), the below will work just fine:


one.include('jslib:one/color/HSL.js');
one.include('jslib:one/color/CMYK.js');
one.include('jslib:one/color/RGB.js');

new one.color.HSL(.4, .3, .9, .9). // HSL with alpha
    adjustBlack(+.1). // Implicit conversion to CMYK (with alpha)
    setGreen(-.1). // Implicit conversion to RGB (with alpha)
    toCSSWithAlpha(); // "rgba(198,0,203,0.9)"

Defined in: HSL.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
one.color.HSL(h, s, l, a)
Field Summary
Field Attributes Field Name and Description
 
a
The alpha value, range: [0.
 
h
The hue component, range: [0.
 
l
The lightness component, range: [0.
 
s
The saturation component, range: [0.
Method Summary
Method Attributes Method Name and Description
 
 
 
 
 
 
setHue(h)
 
 
Convert the color to a one.color.CMYK object.
 
Get a valid CSS color representation of the color without an alpha value.
 
Get a valid CSS color representation of the color, including the alpha value.
 
Get the standard RGB hex representation of the color.
 
Convert the color to a one.color.HSL object, ie.
 
Convert the color to a one.color.HSV object.
 
Convert the color to a JSON representation.
 
Convert the color to a one.color.RGB object.
Class Detail
one.color.HSL(h, s, l, a)
Parameters:
{Number} h
The hue component, range: [0..1]
{Number} s
The saturation component, range: [0..1]
{Number} l
The lightness component, range: [0..1]
{Number} a Optional
The alpha value, range: [0..1], defaults to 1
Field Detail
{Number} a
The alpha value, range: [0..1]

{Number} h
The hue component, range: [0..1]

{Number} l
The lightness component, range: [0..1]

{Number} s
The saturation component, range: [0..1]
Method Detail
{one.color.HSL} adjustAlpha(a)
Parameters:
{Number} a
The value to add to the alpha value. If the resulting value falls outside the supported range, [0..1], it will be adjusted automatically.
Returns:
{one.color.HSL} New color object with the changed value.

{one.color.HSL} adjustHue(h)
Parameters:
{Number} h
The value to add to the hue component. If the resulting value falls outside the supported range, [0..1], it will be adjusted automatically.
Returns:
{one.color.HSL} New color object with the changed value.

{one.color.HSL} adjustLightness(l)
Parameters:
{Number} l
The value to add to the lightness component. If the resulting value falls outside the supported range, [0..1], it will be adjusted automatically.
Returns:
{one.color.HSL} New color object with the changed value.

{one.color.HSL} adjustSaturation(s)
Parameters:
{Number} s
The value to add to the saturation component. If the resulting value falls outside the supported range, [0..1], it will be adjusted automatically.
Returns:
{one.color.HSL} New color object with the changed value.

{one.color.HSL} setAlpha(a)
Parameters:
{Number} a
The new alpha value, range: [0..1]
Returns:
{one.color.HSL} New color object with the changed value.

{one.color.HSL} setHue(h)
Parameters:
{Number} h
The new hue component, range: [0..1]
Returns:
{one.color.HSL} New color object with the changed value.

{one.color.HSL} setSaturation(s)
Parameters:
{Number} s
The new saturation component, range: [0..1]
Returns:
{one.color.HSL} New color object with the changed value.

{one.color.CMYK} toCMYK()
Convert the color to a one.color.CMYK object.
Returns:
{one.color.CMYK}
Requires:
one.color.CMYK

{String} toCSS()
Get a valid CSS color representation of the color without an alpha value.
Returns:
{String} The CSS color string, e.g. "rgb(123, 2, 202)"

{String} toCSSWithAlpha()
Get a valid CSS color representation of the color, including the alpha value.
Returns:
{String} The CSS color string, e.g. "rgba(123, 2, 202, 0.253)"

{String} toHex()
Get the standard RGB hex representation of the color.
Returns:
{String} The hex string, e.g. "#f681df"

{one.color.HSL} toHSL()
Convert the color to a one.color.HSL object, ie. return the object itself.
Returns:
{one.color.HSL}

{one.color.HSV} toHSV()
Convert the color to a one.color.HSV object.
Returns:
{one.color.HSV}
Requires:
one.color.HSV

{Array} toJSON()
Convert the color to a JSON representation.
Returns:
{Array}

{one.color.RGB} toRGB()
Convert the color to a one.color.RGB object.
Returns:
{one.color.RGB}

Documentation generated by JsDoc Toolkit 2.3.2 on Mon Oct 17 2011 19:23:47 GMT+0200 (CEST)