@pbroom/color-kit/planeQueries
colorAtPlanePoint
Returns the color at a normalized point of a plane definition.
import { colorAtPlanePoint } from '@pbroom/color-kit/plane';query.ts:335function 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
- planeDefinition
PlaneDefinition - Plane to sample; a
Planeor anyPlaneDefinition. - point
{ x: number; y: number } - Normalized plane point (
x,yin[0, 1]). - point.x
number - point.y
number
Returns
ColorA new OKLCH color.
Throws
- When the plane model is not supported.
- When the plane definition is otherwise invalid.
Example
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
@pbroom/color-kitthe same declaration, re-exported