[**@wocart/theme v4.1.0**](../../README)

***

[@wocart/theme](../../README) / [index](../README) / contrastRatio

# Function: contrastRatio()

> **contrastRatio**(`a`, `b`): `number`

The WCAG contrast ratio of two hex colors, from 1 to 21. Text needs 4.5 to
meet AA; an editor warns below it. `NaN` for what is not a hex color.

## Parameters

### a

`string`

### b

`string`

## Returns

`number`
