Check a colour pair against WCAG
check_contrastVerify WCAG 2.2 contrast ratios for foreground/background pairs, including transparent and token colors, and compare against the threshold for body text, large text, or UI components.
Instructions
WCAG 2.2 contrast for the rendered foreground/background pair. Supports hex, transparent, modern rgb() and token names. Composites background over an explicit opaque backdrop, or the disclosed theme base when omitted, then foreground over that background.
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": "check_contrast"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| use | No | What the pair is for. Drives the threshold: 4.5:1 body, 3:1 large text and UI components. | |
| theme | No | Theme to resolve token names in (default light). | |
| backdrop | No | Opaque hex/CSS colour or token beneath the background. Defaults to the selected theme base, disclosed in the result. | |
| background | Yes | Hex/CSS colour, or a token name. | |
| foreground | Yes | Hex value, or a token name like "color-text-primary". |