@pbroom/color-kit/planeQueries
getPlaneGamutBoundary
Traces the gamut's maximum-chroma edge at one hue and projects it onto the plane.
import { getPlaneGamutBoundary } from '@pbroom/color-kit/plane';gamut-boundary.ts:54function 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
- planeDefinition
PlaneDefinition - Plane to project onto; a
Planeor anyPlaneDefinition. - query?
Omit<PlaneGamutBoundaryQuery, 'kind'>default{} - Boundary options; see
PlaneGamutBoundaryQuery.
Returns
PlaneGamutBoundaryResultA new result with the gamut, resolved hue and boundary points.
Throws
- When
gamutis not'srgb'or'display-p3'(including the removed'p3'). - On an OKLCH lightness × chroma plane with uniform sampling, when
stepsis not an integer of at least 2.
Example
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
@pbroom/color-kitthe same declaration, re-exported