clamp
Clamp value to the inclusive range [min, max].
import { clamp } from '@pbroom/color-kit';index.ts:21function clamp( value: number, , min: number, , max: number,): number;Parameters
Returns
numbervalue limited to [min, max]
Example
import { clamp } from '@pbroom/color-kit';
clamp(1.2, 0, 1); // → 1
clamp(-5, 0, 255); // → 0