How the contrast checker works
Convert sRGB channels to linear-light values, combine them into relative luminance, identify the lighter and darker colors, and apply the WCAG contrast-ratio formula.
contrast = (lighter luminance + 0.05) ÷ (darker luminance + 0.05)WCAG AA requires 4.5:1 for normal text and 3:1 for large text; AAA uses 7:1 and 4.5:1.
Check #10221d text on #fffefa
This dark green text on a warm near-white background produces a high contrast ratio that passes AA and AAA thresholds for normal and large text.
Copyable code examples
Use these examples as a starting point, then match the values and assumptions to the rendered project.
:root {
--text: #10221d;
--background: #fffefa;
}
body { color: var(--text); background: var(--background); }const ratio = (lighter + 0.05) / (darker + 0.05);Using the result accurately
Check every interactive state and actual text size and weight. Contrast is one accessibility requirement; readable typography, visible focus, non-color cues, and usable interaction remain necessary.
A passing mathematical ratio does not guarantee readability over gradients, images, transparency, thin fonts, anti-aliasing, or altered display conditions. Test the rendered interface as well.
References: W3C Understanding WCAG 2.2: Contrast (Minimum).