Contrast Repair
Find the fewest color-token changes that make all your declared foreground and background pairs pass together.
Checking contrast
Preparing the project.
Proof a pair
Ratios use opaque solid sRGB colors. The unrounded ratio decides whether each requirement passes.
Project editor
Declare each real use and the contrast it must reach.
Each role is a CSS custom property. Lock a role to keep its current color.
Choose colors the solver may use. Each role can also keep its starting color.
Take the repair
Load the patch after the original rule in the same cascade layer. The report includes the project, assignment, ratios and search outcome.
Contrast rules, search limits and verification
Choose thresholds for the actual uses in your design. WCAG 2.2 sets a 4.5:1 minimum for normal text and 3:1 for large text at Level AA, with exceptions. Enhanced contrast uses 7:1 for normal text and 4.5:1 for large text. Non-text contrast has its own applicability rules. Minimum text contrast · Enhanced text contrast · Non-text contrast.
Supply the final opaque foreground and background for each use. Transparency, images, gradients, inherited states, typography and context need separate inspection. A passing project covers only the declared pairs. You can create up to 24 tokens, 24 approved swatches and 96 pairs.
Within those specified choices, the solver first minimizes the number of role colors changed. It breaks ties by adding the distances between original and assigned colors in OKLab, each rounded to the nearest hundred-thousandth. A CSS alias can follow a changed source or need an override to retain its starting color, so the exported declaration count can differ. Locks and per-role swatch restrictions narrow the search. A search limit can leave a usable candidate or an unresolved project.
For a second implementation, download the standalone checker beside your exported report and run node check.mjs contrast-report.json. Its work limit can leave a valid assignment without an optimality proof. Refresh or navigation can clear this tab. Save project JSON or a report to resume your work. Apply pending edits before saving.