View source

abstract thx.color.Hsl(Array<Float>)

Available on all platforms

HSL (hue-saturation-lightness) is one of the most common cylindrical-coordinate representations of points in an RGB color model. Developed in the 1970s for computer graphics applications, HSL is used today in color pickers, in image editing software, and less commonly in image analysis and computer vision.

The representation rearranges the geometry of RGB in an attempt to be more intuitive and perceptually relevant than the cartesian (cube) representation, by mapping the values into a cylinder loosely inspired by a traditional color wheel. The angle around the central vertical axis corresponds to "hue" and the distance from the axis corresponds to "saturation". These first two values give the two schemes the 'H' and 'S' in its name. The height corresponds to a third value, the system's representation of the perceived luminance in relation to the saturation.

Class Fields

inline function create(hue:Float, saturation:Float, lightness:Float):Hsl

function fromFloats(arr:Array<Float>):Hsl

function fromString(color:String):Null<Hsl>

Instance Fields

var hue(get,null):Float

var lightness(get,null):Float

var saturation(get,null):Float

function analogous(spread:Float = 30.0):Tuple2<Hsl, Hsl>

function complement():Hsl

function darker(t:Float):Hsl

function equals(other:Hsl):Bool

function interpolate(other:Hsl, t:Float):Hsl

function interpolateWidest(other:Hsl, t:Float):Hsl

function lighter(t:Float):Hsl

function max(other:Hsl):Hsl

function min(other:Hsl):Hsl

function nearEquals(other:Hsl, tolerance:Float = Floats.EPSILON):Bool

function normalize():Hsl

function rotate(angle:Float):Hsl

function roundTo(decimals:Int):Hsl

function split(spread:Float = 144.0):Tuple2<Hsl, Hsl>

function square():Tuple4<Hsl, Hsl, Hsl, Hsl>

function tetrad(angle:Float):Tuple4<Hsl, Hsl, Hsl, Hsl>

function toCmy():Cmy

function toCmyk():Cmyk

function toCss3():String

function toGrey():Grey

function toHsla():Hsla

function toHsv():Hsv

function toLCh():LCh

function toLab():Lab

function toLuv():Luv

function toRgb():Rgb

function toRgba():Rgba

function toRgbx():Rgbx

function toRgbxa():Rgbxa

function toString():String

function toXyz():Xyz

function toYuv():Yuv

function toYxy():Yxy

function triad():Tuple3<Hsl, Hsl, Hsl>

function withAlpha(alpha:Float):Hsla

function withHue(newhue:Float):Hsl

function withLightness(newlightness:Float):Hsl

function withSaturation(newsaturation:Float):Hsl