Class Index | File Index | UML

Classes


Class one.color.HSV


UML

A color in the HSV 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.HSV#toRGB}, one.color.HSV#toHSL...), the below will work just fine:


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

new one.color.HSV(.9, .2, .4).
    adjustBlue(-.4). // Implicit conversion to RGB
    setCyan(-.1). // Implicit conversion to CMYK
    toHex(); // "#665200"

Defined in: HSV.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
one.color.HSV(h, s, v, a)
Field Summary
Field Attributes Field Name and Description
 
a
The alpha value, range: [0.
 
h
The hue component, range: [0.
 
s
The saturation component, range: [0.
 
v
The value 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.
 
Convert the color to a one.color.HSV object, ie.
 
Convert the color to a JSON representation.
 
Convert the color to a one.color.RGB object.
Class Detail
one.color.HSV(h, s, v, a)
Parameters:
{Number} h
The hue component, range: [0..1]
{Number} s
The saturation component, range: [0..1]
{Number} v
The value 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} s
The saturation component, range: [0..1]

{Number} v
The value component, range: [0..1]
Method Detail
{one.color.HSV} 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.HSV} New color object with the changed value.

{one.color.HSV} 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.HSV} New color object with the changed value.

{one.color.HSV} 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.HSV} New color object with the changed value.

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

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

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

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

{one.color.HSV} setValue(l)
Parameters:
{Number} l
The new value component, range: [0..1]
Returns:
{one.color.HSV} New color object with the changed value.

{one.color.CMYK} toCMYK()
Convert the color to a one.color.CMYK object.
Returns:
{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.
Returns:
{one.color.HSL}
Requires:
one.color.HSL

{one.color.HSV} toHSV()
Convert the color to a one.color.HSV object, ie. return the object itself.
Returns:
{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)