@pbroom/color-kit/planeQueries
getPlaneChromaBand
Samples a constant-intent chroma band across lightness at one hue and projects it onto the plane.
import { getPlaneChromaBand } from '@pbroom/color-kit/plane';chroma-band.ts:56function getPlaneChromaBand(
planeDefinition: PlaneDefinition,
query?: Omit<PlaneChromaBandQuery, 'kind'>,
): PlaneChromaBandResult;In 'clamped' mode (default) each sample uses requestedChroma, reduced to the gamut's maximum where it does not fit; 'proportional' keeps the requested/max-chroma ratio measured at selectedLightness. Missing requestedChroma, selectedLightness and alpha come from the plane's fixed c, l and alpha. Each point carries OKLCH l/c and plane x/y.
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<PlaneChromaBandQuery, 'kind'>default{} - Band options; see
PlaneChromaBandQuery.
Returns
PlaneChromaBandResultA new result with the resolved hue and band points.
Throws
- When
gamutis not'srgb'or'display-p3'. - On an OKLCH lightness × chroma plane with uniform sampling, when
stepsis not an integer of at least 2.
Example
import { definePlane, getPlaneChromaBand } from '@pbroom/color-kit/plane';
const plane = definePlane({ fixed: { h: 264 } });
const { points } = getPlaneChromaBand(plane, { requestedChroma: 0.1 });
points.length; // → 13
points[6]; // → { l: 0.5, c: 0.1, x: 0.5, y: ≈ 0.75 }
points[1].c.toFixed(3); // → '0.058' (clamped to the sRGB edge)See also
sense for the fluent form.
Also exported from
@pbroom/color-kitthe same declaration, re-exported