Struct Oklab

Stores a color in Cartesian Oklab coordinates.

struct Oklab(T)
  
if (is(T == float) || is(T == double));

Use Oklab for perceptual calculations that need separate lightness and opponent-color axes. T must be float or double. Construction stores components unchanged; it does not clamp or canonicalize them.

The natural .init value contains NaNs and is not a usable color.

Fields

NameTypeDescription
a TGreen-red opponent component.
b TBlue-yellow opponent component.
l TPerceptual lightness component.

Aliases

NameDescription
Scalar Scalar component type.

Example

const lab = Oklabd(0.60, 0.10, -0.05);

assert(lab.l == 0.60);
assert(lab.a == 0.10);
assert(lab.b == -0.05);