Function: contrast()
ts
function contrast(color1, color2): string;Defined in: contrast.ts:17
The contrast function calculates the contrast ratio between two colors. Implementation of http://www.w3.org/TR/WCAG20/#contrast-ratiodef
Parameters
| Parameter | Type | Description |
|---|---|---|
color1 | Color | The first color to compare. |
color2 | Color | The second color to compare. |
Returns
string
- The contrast ratio between two colors in the format of "X.X:1".
Throws
- Throws an error if either of the color arguments is invalid.