Packageardisia.utils
Classpublic final class HSLColor
InheritanceHSLColor Inheritance Object

Helper class for HSL color. Provides some useful static class functions and can also be instantiated to store a HSL color value. Used by the ColorSpacePicker class.

See http://en.wikipedia.org/wiki/HSL_color_space for a general explanation of the HSL color space and see http://www.niwa.nu/2013/05/math-behind-colorspace-conversions-rgb-hsl/ for a great explanation of the Math behind the code below in plain English.



Public Properties
 PropertyDefined By
  hue : Number
Hue.
HSLColor
  luminosity : Number
Luminosity.
HSLColor
  saturation : Number
Saturation.
HSLColor
Public Methods
 MethodDefined By
  
HSLColor(hue:Number = 1, saturation:Number = 1, luminosity:Number = 1)
HSLColor
  
convertHSLtoRGB(h:Number, s:Number, l:Number):uint
[static] Convert HSL color to RGB.
HSLColor
  
[static] Convert RGB color to HSL.
HSLColor
Property Detail
hueproperty
public var hue:Number

Hue. Varies from 0 to 360.

The default value is null.

luminosityproperty 
public var luminosity:Number

Luminosity. Varies from 0 to 1.

The default value is null.

saturationproperty 
public var saturation:Number

Saturation. Varies from 0 to 1.

The default value is null.

Constructor Detail
HSLColor()Constructor
public function HSLColor(hue:Number = 1, saturation:Number = 1, luminosity:Number = 1)



Parameters
hue:Number (default = 1)
 
saturation:Number (default = 1)
 
luminosity:Number (default = 1)
Method Detail
convertHSLtoRGB()method
public static function convertHSLtoRGB(h:Number, s:Number, l:Number):uint

Convert HSL color to RGB. See http://en.wikipedia.org/wiki/HSL_color_space.

Hue set is [0, 360]; Saturation and Luminosity sets are [0, 1].

Good English language explanation for the Math behind this code can be found at http://colorgrader.net/index.php/dictionary-a-tutorials/color-theory/93-math-behind-colorspace-conversions-rgb-hsl.html

Parameters

h:Number — hue value
 
s:Number — saturation value
 
l:Number — lightness value

Returns
uint — the uint RGB color
convertRGBtoHSL()method 
public static function convertRGBtoHSL(rgb:uint):HSLColor

Convert RGB color to HSL.

Hue set is [0 - 360]; Saturation and Luminosity sets are [0, 1].

Good English language explanation for the Math behind this code can be found at http://www.niwa.nu/2013/05/math-behind-colorspace-conversions-rgb-hsl/

Parameters

rgb:uint — a RGB color value

Returns
HSLColor — An HSLColor object