Function Oklch.canonicalized
Returns an equivalent representation with non-negative chroma.
Use this before operations that require canonical OKLCH. Negative chroma becomes positive and hue rotates by 180 degrees. Ordinary raw hue revolutions are preserved; very large finite hues may be reduced before rotation when floating-point precision cannot represent the raw 180-degree increment. Non-finite hue remains non-finite.
Returns
An equivalent OKLCH representation with non-negative chroma.
Example
const raw = Oklchd(-0.1, -0.2, OklabHued .fromDegrees(30.0));
const canonical = raw .canonicalized;
assert(canonical .l == raw .l);
assert(canonical .c == 0.2);
assert(canonical .h .rawDegrees == 210.0);
}