View source

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

Available on all platforms

A Lab color space is a color-opponent space with dimension L for lightness and a and b for the color-opponent dimensions, based on nonlinearly compressed (e.g. CIE XYZ color space) coordinates. The terminology originates from the three dimensions of the Hunter 1948 color space, which are L, a, and b. The difference between the original Hunter and CIE color coordinates is that the CIE coordinates are based on a cube root transformation of the color data, while the Hunter coordinates are based on a square root transformation.

The Lab color space includes all perceivable colors, which means that its gamut exceeds those of the RGB and CMYK color models. One of the most important attributes of the Lab-model is device independence. This means that the colors are defined independent of their nature of creation or the device they are displayed on.

The Lab color space is used when graphics for print have to be converted from RGB to CMYK, as the Lab gamut includes both the RGB and CMYK gamut. Also it is used as an interchange format between different devices as for its device independency. The space itself is a three-dimensional Real number space, that contains an infinite possible representations of colors.

The lightness, L, represents the darkest black at L = 0, and the brightest white at L = 100. The color channels, a and b, will represent true neutral gray values at a = 0 and b = 0. The red/green opponent colors are represented along the a axis, with green at negative a values and red at positive a values. The yellow/blue opponent colors are represented along the b axis, with blue at negative b values and yellow at positive b values. The scaling and limits of the a and b* axes run in the range of ±100 or -128 to +127.

Class Fields

inline function create(l:Float, a:Float, b:Float):Lab

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

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

Instance Fields

var a(get,null):Float

var b(get,null):Float

var l(get,null):Float

function distance(other:Lab):Float

function equals(other:Lab):Bool

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

function match(palette:Iterable<Lab>):Lab

function max(other:Lab):Lab

function min(other:Lab):Lab

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

function roundTo(decimals:Int):Lab

function toCmy():Cmy

function toCmyk():Cmyk

function toGrey():Grey

function toHsl():Hsl

function toHsv():Hsv

function toLCh():LCh

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 withA(newa:Float):Lab

function withB(newb:Float):Lab

function withL(newl:Float):Lab