@pbroom/color-kit/driverColor input
normalizeColorInputValue
Wraps value into range when wrap is true, otherwise clamps it. Wrapping keeps a value equal to max at max (360 stays 360, not 0). A non-finite value returns range[0]; an empty or inverted range returns value unchanged.
import { normalizeColorInputValue } from '@pbroom/color-kit/driver';color-input.ts:468function normalizeColorInputValue(
value: number,
range: [number, number],
wrap: boolean,
): number;Parameters
Returns
number
Example
import { normalizeColorInputValue } from '@pbroom/color-kit/driver';
normalizeColorInputValue(400, [0, 360], true); // → 40
normalizeColorInputValue(-20, [0, 360], true); // → 340
normalizeColorInputValue(1.2, [0, 1], false); // → 1