Reference · Backgrounds for a bracket
contrastRatiofunction
The contrast between two colours, from 1 (the same) to 21 (black on white).
Import it
import { contrastRatio } from "@johnmorrisdotca/taisen-brackets/backgrounds";
Also exported from: @johnmorrisdotca/taisen-brackets
Definition
function contrastRatio(a: Parameters<typeof shared.contrastRatio>[0], b: Parameters<typeof shared.contrastRatio>[1]): number
Parameters
| Name | Type | Description |
|---|---|---|
a | Rgb | The first colour, as red, green and blue. |
b | Rgb | The second colour. |
Returns
number
The WCAG contrast ratio.
Examples
import { contrastRatio } from "@johnmorrisdotca/taisen-brackets/backgrounds";
console.log(contrastRatio([255, 255, 255], [0, 0, 0]));21What it prints (run when this page was built)