@pbroom/color-kit/driverColor area
getColorAreaThumbPosition
Normalized thumb position of color in the area: x runs left to right and y top to bottom, so a y-axis value at its range end sits at y = 0. Both coordinates are clamped to [0, 1].
import { getColorAreaThumbPosition } from '@pbroom/color-kit/driver';color-area.ts:416function getColorAreaThumbPosition(
color: Color,
axes: ResolvedColorAreaAxes,
): { x: number; y: number };Parameters
Returns
{ x: number; y: number }
Example
import { getColorAreaThumbPosition, resolveColorAreaAxes } from '@pbroom/color-kit/driver';
const axes = resolveColorAreaAxes(); // x: l [0, 1], y: c [0, 0.4]
getColorAreaThumbPosition({ l: 0.6, c: 0.1, h: 250, alpha: 1 }, axes);
// → { x: 0.6, y: 0.75 }