check_contrast
Check contrast between foreground and background colors using WCAG 2.x or APCA, detect color-blindness contrast drops, and get a hue-preserving fix when accessibility fails.
Instructions
Check contrast between two colors using WCAG 2.x luminance ratio, APCA Lc (WCAG 3 draft), or both. Also checks color-blindness contrast drops and suggests an exact hue-preserving fix if contrast fails.
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": {
"background": "<background>",
"foreground": "<foreground>"
},
"name": "check_contrast"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| algorithm | No | Contrast algorithm: 'wcag' (WCAG 2.x ratio), 'apca' (Lc, WCAG 3 draft), or 'both' | wcag |
| background | Yes | Background color | |
| foreground | Yes | Foreground/text color | |
| suggestFix | No | Include nearest hue-preserving AA fix and CVD/optical warnings when issues exist |