meetsWcagAa function
Returns true when colors satisfy WCAG AA contrast requirements.
largeText uses the WCAG relaxed threshold (3:1) for normal contrast checks
on larger text sizes.
Implementation
bool meetsWcagAa(
Color foreground,
Color background, {
bool largeText = false,
bool hasDarkBackground = true,
}) {
return contrastRatio(
foreground,
background,
hasDarkBackground: hasDarkBackground,
) >=
(largeText ? 3.0 : 4.5);
}