@pbroom/color-kitContrast

contrastRegionPath

Returns the longest contour path (most points) of contrastRegionPaths, or [] when the region is empty.

functionimport { contrastRegionPath } from '@pbroom/color-kit';region.ts:86
function contrastRegionPath(
  reference: Color,
  hue: number,
  options?: ContrastRegionPathOptions,
  trace?: InternalPlaneTraceContext | null,
): ContrastRegionPoint[];

Takes the same arguments and throws under the same conditions as contrastRegionPaths.

Parameters

referenceColor
Color the samples are measured against.
huenumber
OKLCH hue in degrees (wrapped).
options?ContrastRegionPathOptionsdefault {}
Gamut, metric, threshold and sampling options.
trace?InternalPlaneTraceContext | null
Internal tracing context used by the plane query layer; omit it.

Returns

ContrastRegionPoint[]One contour path of { l, c } points.

Example

TypeScript
import { contrastRegionPath, parse } from '@pbroom/color-kit';

const path = contrastRegionPath(parse('#fff'), 250); // AA (4.5:1) vs white
path.length; // → 57
path[0]; // → { l: ≈ 0.5681, c: 0 }