@pbroom/color-kit/planeQueries

colorAtPlanePoint

Returns the color at a normalized point of a plane definition.

functionimport { colorAtPlanePoint } from '@pbroom/color-kit/plane';query.ts:335
function colorAtPlanePoint(
  planeDefinition: PlaneDefinition,
  point: { x: number; y: number },
): Color;

Resolves planeDefinition and calls planeToColor: x/y are clamped to [0, 1] and the result is not gamut-mapped. When the plane is already resolved, call planeToColor() directly to skip re-resolving it.

Parameters

point{ x: number; y: number }
Normalized plane point (x, y in [0, 1]).
point.xnumber
point.ynumber

Returns

ColorA new OKLCH color.

Throws

  • When the plane model is not supported.
  • When the plane definition is otherwise invalid.

Example

TypeScript
import { toHex } from '@pbroom/color-kit';
import { colorAtPlanePoint } from '@pbroom/color-kit/plane';

toHex(colorAtPlanePoint({ fixed: { h: 264 } }, { x: 0.6, y: 0.75 }));
// → '#617fbc'

Also exported from