@pbroom/color-kitGamut

chromaBand

Returns a tonal strip of OKLCH colors from black to white at a fixed hue, keeping each step inside the target gamut.

functionimport { chromaBand } from '@pbroom/color-kit';chroma-band.ts:50
function chromaBand(
  hue: number,
  requestedChroma: number,
  options?: ChromaBandOptions,
): Color[];
  • 'clamped' (default): use requestedChroma where the gamut allows it, otherwise the boundary chroma at that lightness.
  • 'proportional': take the ratio of requestedChroma to the boundary chroma at selectedLightness (capped at 1) and apply it to the boundary chroma at every step.

Uniform sampling returns steps + 1 colors; adaptive sampling follows gamutBoundaryPath and, in clamped mode, adds a color where the boundary crosses requestedChroma. Every color carries the normalized hue and options.alpha.

Parameters

huenumber
OKLCH hue in degrees.
requestedChromanumber
Desired OKLCH chroma (negative values act as 0).
options?ChromaBandOptionsdefault {}
Mode, sampling, gamut and search options.

Returns

Color[]Colors ordered by increasing lightness.

Throws

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

Example

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

chromaBand(250, 0.1, { steps: 4 }).map((color) => color.c);
// → [0, 0.070703125, 0.1, 0.1, 0]