Check text/background contrast against WCAG
checkContrastCalculate contrast ratio between foreground and background colors to verify WCAG 2.x legibility. Returns ratio and AA/AAA pass status; supports large text flag.
Instructions
Check whether a foreground color is legible on a background color per WCAG 2.x contrast ratios. Returns the ratio (1-21) and whether it passes AA and AAA. Set large=true for text >=18pt (or 14pt bold). This is the legibility axis, separate from color-blindness.
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": {
"foreground": "<foreground>",
"background": "<background>"
},
"name": "checkContrast"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| large | No | True if text is >=18pt or 14pt bold (default false) | |
| background | Yes | Background hex color, e.g. #ffffff | |
| foreground | Yes | Text/foreground hex color, e.g. #767676 |