Skip to main content

contrast_ratio

Function contrast_ratio 

Source
pub fn contrast_ratio(foreground: Color, background: Color) -> f32
Expand description

The WCAG 2.x contrast ratio of a foreground over a background, from 1 to 21. A translucent foreground is first painted over the background; the background is taken as opaque.