@pbroom/color-kit/driverColor slider

getColorSliderThumbPosition

Normalized thumb position ([0, 1], clamped) of color[channel] within range; 0 is the range start.

functionimport { getColorSliderThumbPosition } from '@pbroom/color-kit/driver';color-slider.ts:148
function getColorSliderThumbPosition(
  color: Color,
  channel: ColorSliderChannel,
  range: [number, number],
): number;

Parameters

range[number, number]

Returns

number

Example

TypeScript
import { getColorSliderThumbPosition } from '@pbroom/color-kit/driver';

getColorSliderThumbPosition({ l: 0.6, c: 0.1, h: 250, alpha: 1 }, 'c', [0, 0.4]); // → 0.25

See also