@pbroom/color-kitGamut

gamutBoundaryPath

Samples the OKLCH lightness/chroma gamut boundary at a fixed hue, from black (l: 0) to white (l: 1).

functionimport { gamutBoundaryPath } from '@pbroom/color-kit';boundary-path.ts:51
function gamutBoundaryPath(
  hue: number,
  options?: GamutBoundaryPathOptions,
): GamutBoundaryPoint[];

Each point's c is maxChromaAt at that lightness. In 'uniform' mode (the default) the path has steps + 1 evenly spaced points; in 'adaptive' mode points are added around the hue cusp and where the boundary bends. Output is deterministic and usable for SVG/Canvas overlay paths.

Parameters

huenumber
OKLCH hue in degrees.
options?GamutBoundaryPathOptionsdefault {}
Gamut, sampling and search options.

Returns

GamutBoundaryPoint[]Boundary points ordered by increasing lightness.

Throws

  • When options.gamut is not 'srgb' or 'display-p3'.
  • When steps is not an integer >= 2 (uniform mode).

Example

TypeScript
import { gamutBoundaryPath } from '@pbroom/color-kit';

gamutBoundaryPath(250, { steps: 4 });
// → [
//   { l: 0, c: 0 },
//   { l: 0.25, c: 0.070703125 },
//   { l: 0.5, c: 0.14150390625 },
//   { l: 0.75, c: 0.13369140625 },
//   { l: 1, c: 0 },
// ]

See also