---
id: fast-colors.clamp
title: clamp() function
hide_title: true
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[@microsoft/fast-colors](./fast-colors.md) &gt; [clamp](./fast-colors.clamp.md)

## clamp() function

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

<b>Signature:</b>

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

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  i | number | the number to clamp |
|  min | number | the maximum (inclusive) value |
|  max | number | the minimum (inclusive) value |

<b>Returns:</b>

number
