Function toOklch
Converts Cartesian Oklab to lightness, chroma, and hue.
Use this when chroma or hue is easier to work with directly. Non-achromatic
results have non-negative chroma and hue from 0° inclusive to 360° exclusive. Exactly achromatic
Oklab is represented as C = 0, h = 0°. Extreme finite components are
handled without avoidable loss from intermediate magnitude calculations.
Parameters
| Name | Description |
|---|---|
| color | Oklab value to convert. |
Returns
The corresponding OKLCH value.
See Also
toOklab
Example
const neutral = Oklabd(0.5, 0.0, 0.0) .toOklch;
assert(neutral .l == 0.5);
assert(neutral .c == 0.0);
assert(neutral .h .rawDegrees == 0.0);