Skip to main content

style_contrast_ratio

Function style_contrast_ratio 

Source
pub fn style_contrast_ratio(style: &Style) -> Option<f32>
Expand description

Contrast ratio of a style’s foreground against the active theme background.

Returns None when the style carries no RGB foreground (unset, ANSI16, or ANSI256 are not theme-relative). Consumers that build their own styled surfaces — for example the CLI exit postamble — use this to prove the surface meets the configured WCAG minimum (get_minimum_contrast, 4.5:1 by default) instead of shipping hand-picked colors.