contrast-fix
WCAG 2.2 contrast check with the minimal OKLCH lightness fix and colour-blind pair check — Checks up to 50 foreground/background hex pairs against a WCAG 2.2 contrast threshold (4.5 AA text, 3 large text and UI, 7 AAA, or your own) on the unrounded ratio, so 4.499 fails and exactly 4.5 passes, and for a failing pair returns the closest colour by OKLCH lightness (chroma and hue held, gamut-clipped, 8-bit) that meets it. Optionally simulates protanomaly, deuteranomaly and tritanomaly (Mac
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"pairs": "<pairs>"
},
"name": "contrast-fix"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| level | No | aa-normal 4.5 (default), aa-large 3, aaa-normal 7, aaa-large 4.5, non-text 3 (WCAG 2.2 SC 1.4.3, 1.4.6, 1.4.11). | |
| pairs | Yes | Foreground/background pairs. | |
| fixTarget | No | Which colour to move for a failing pair (default foreground); none skips the fix. | |
| threshold | No | Overrides level: the minimum contrast ratio. | |
| cvdSeverity | No | Enables the colour-vision-deficiency check at this severity, 0 to 1 (1.0 is dichromacy); between the published 0.1 steps the matrices are interpolated. | |
| cvdMinDeltaE | No | Smallest OKLab distance counted as distinguishable (default 0.05, a heuristic, not a standard). |