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

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

## contrastRatio() function

Calculate the contrast ratio between two colors. Uses the formula described by [WCAG 2.0](https://www.w3.org/TR/WCAG20-TECHS/G17.html)<!-- -->.

<b>Signature:</b>

```typescript
export declare function contrastRatio(a: ColorRGBA64, b: ColorRGBA64): number;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  a | [ColorRGBA64](./fast-colors.colorrgba64.md) |  |
|  b | [ColorRGBA64](./fast-colors.colorrgba64.md) |  |

<b>Returns:</b>

number

## Remarks

The alpha channel of the input is ignored
