@pbroom/color-kit/planeMapping

planeToColor

Converts a normalized plane point into the color it represents.

functionimport { planeToColor } from '@pbroom/color-kit/plane';mapping.ts:110
function planeToColor(  resolvedPlane: Plane, ,  point: PlanePoint,): Color;

x and y are clamped to [0, 1] and mapped linearly onto the plane's axis ranges; every other channel comes from resolvedPlane.fixed. The result is an OKLCH Color and is not gamut-mapped.

Parameters

pointPlanePoint
Normalized plane point (x, y in [0, 1]).

Returns

ColorA new color for that point.

Example

TypeScript
import { toHex } from '@pbroom/color-kit';
import { definePlane, planeToColor } from '@pbroom/color-kit/plane';

const plane = definePlane({ fixed: { h: 264 } }); // x: l, y: c in [0.4, 0]
const color = planeToColor(plane, { x: 0.6, y: 0.75 });
// → { l: 0.6, c: ≈ 0.1, h: 264, alpha: 1 }
toHex(color); // → '#617fbc'

See also

Also exported from