@pbroom/color-kit/planeQueries

getPlaneGamutBoundary

Traces the gamut's maximum-chroma edge at one hue and projects it onto the plane.

functionimport { getPlaneGamutBoundary } from '@pbroom/color-kit/plane';gamut-boundary.ts:54
function getPlaneGamutBoundary(
  planeDefinition: PlaneDefinition,
  query?: Omit<PlaneGamutBoundaryQuery, 'kind'>,
): PlaneGamutBoundaryResult;

Samples the boundary from black (l = 0) to white (l = 1) and returns one point per sample, each with its OKLCH l/c and plane x/y. Draw it with toSvgPath; for a filled, viewport-clipped shape that also works on non-L×C planes, use getPlaneGamutRegion.

Only OKLCH lightness × chroma planes produce geometry (see usesLightnessAndChroma); any other plane validates gamut, then returns an empty list without validating the remaining query options.

Parameters

planeDefinitionPlaneDefinition
Plane to project onto; a Plane or any PlaneDefinition.
query?Omit<PlaneGamutBoundaryQuery, 'kind'>default {}
Boundary options; see PlaneGamutBoundaryQuery.

Returns

PlaneGamutBoundaryResultA new result with the gamut, resolved hue and boundary points.

Throws

  • When gamut is not 'srgb' or 'display-p3' (including the removed 'p3').
  • On an OKLCH lightness × chroma plane with uniform sampling, when steps is not an integer of at least 2.

Example

TypeScript
import { definePlane, getPlaneGamutBoundary } from '@pbroom/color-kit/plane';

const plane = definePlane({ fixed: { h: 264 } }); // OKLCH, x: l, y: c
const { points } = getPlaneGamutBoundary(plane, { steps: 50 });
points.length; // → 51
points[25]; // → { l: 0.5, c: ≈ 0.2811, x: 0.5, y: ≈ 0.2974 }

See also

sense for the fluent form.

Also exported from