---
id: fast-components.palette.colorcontrast
title: Palette.colorContrast() method
hide_title: true
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[@microsoft/fast-components](./fast-components.md) &gt; [Palette](./fast-components.palette.md) &gt; [colorContrast](./fast-components.palette.colorcontrast.md)

## Palette.colorContrast() method

Returns a swatch from the palette that most closely matches the contrast ratio provided to a provided reference.

<b>Signature:</b>

```typescript
colorContrast(reference: Swatch, contrast: number, initialIndex?: number, direction?: 1 | -1): T;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  reference | [Swatch](./fast-components.swatch.md) |  |
|  contrast | number |  |
|  initialIndex | number |  |
|  direction | 1 \| -1 |  |

<b>Returns:</b>

T
