contrastRatio
WCAG contrast ratio, from 1 to 21, between two opaque colours.
This is a function exported by @mapcairn/theme, checked against version 0.2.0.
Signature
import { contrastRatio } from "@mapcairn/theme";
function contrastRatio(a: ColourInput, b: ColourInput): number;
Parameters
a(ColourInput)b(ColourInput)
Returns
number
Throws
- When either colour is translucent. Composite it over a backdrop
with
compositeOverfirst, because the ratio depends on it.