Skip to main content

@microsoft/fast-colors > clamp

clamp() function

Ensures that an input number does not exceed a max value and is not less than a min value.

Signature:
export declare function clamp(i: number, min: number, max: number): number;

Parameters

ParameterTypeDescription
inumberthe number to clamp
minnumberthe maximum (inclusive) value
maxnumberthe minimum (inclusive) value
Returns:

number