@pbroom/color-kitGamut

maxChromaForHue

Returns the hue cusp: the OKLCH lightness/chroma point with the maximum in-gamut chroma for a fixed hue.

functionimport { maxChromaForHue } from '@pbroom/color-kit';hue-cusp.ts:212
function 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

huenumber
OKLCH hue in degrees.
options?MaxChromaForHueOptionsdefault {}
Gamut, method and LUT size.

Returns

HueCuspThe cusp { l, c }.

Throws

  • When options.gamut is not 'srgb' or 'display-p3'.
  • When options.method is not 'direct' or 'lut'.

Example

TypeScript
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 }

See also