maxChromaForHue
Returns the hue cusp: the OKLCH lightness/chroma point with the maximum in-gamut chroma for a fixed hue.
import { maxChromaForHue } from '@pbroom/color-kit';hue-cusp.ts:212function maxChromaForHue(
hue: number,
options?: MaxChromaForHueOptions,
): HueCusp;'direct' solves the cusp analytically without scanning lightness. 'lut' (the default) interpolates a per-gamut lookup table built on first use and cached, for high-throughput repeated queries (e.g. interactive wheels/overlays); its result can differ from 'direct' by interpolation error.
Parameters
- hue
number - OKLCH hue in degrees.
- options?
MaxChromaForHueOptionsdefault{} - Gamut, method and LUT size.
Returns
HueCuspThe cusp { l, c }.
Throws
- When
options.gamutis not'srgb'or'display-p3'. - When
options.methodis not'direct'or'lut'.
Example
import { maxChromaForHue } from '@pbroom/color-kit';
maxChromaForHue(250); // → { l: ≈ 0.6614, c: ≈ 0.1872 }
maxChromaForHue(250, { gamut: 'display-p3' }); // → { l: ≈ 0.6227, c: ≈ 0.2276 }