WCAG AA / AAA contrast checker for any colour pair, with real text preview at three sizes and a one-click "suggest a passing variation" that finds the smallest hue-preserving change.
Contrast is the ratio of relative luminance between two colours, defined in the WCAG 2 spec. 4.5:1 is the threshold for AA-level normal text and 7:1 for AAA. Large text — ≥18pt regular, or ≥14pt bold — gets a more relaxed threshold of 3:1 (AA) or 4.5:1 (AAA). The luminance formula is from W3C's G18 technique.
The "suggest a passing variation" button walks the foreground (preferred, since text usually has more flexibility) through HSL lightness in 1% steps until the ratio passes AA Normal (4.5:1). If the foreground can't reach the threshold within its own hue, it falls back to nudging the background. The result is the smallest hue-preserving change that passes — not the closest perceptually, but close enough.
No dependencies — pure browser, pure WCAG formula.