Skip to main content

contrast_ratio

Function contrast_ratio 

Source
pub fn contrast_ratio(a: Hsla, b: Hsla) -> f32
Expand description

WCAG 2.1 contrast ratio between two opaque colors (1.0 … 21.0).

Used by the palette tests to prove each light token reproduces the contrast its dark counterpart had, rather than merely looking plausible.