Check contrast
kaava_check_contrastCheck a foreground/background color pair against WCAG 2.2 and APCA Lc; when it fails, return the nearest passing same-hue color and valid system text colors.
Instructions
Check one foreground/background pair against WCAG 2.2 and report the APCA Lc value. Each color is a CSS color ("#767676", "rgb(0 0 0 / 0.6)") or a token of the current design system ("color.fg-muted", "--color-primary", "palette.neutral.400"). When the pair fails, returns the nearest passing color of the same hue and the system text colors that do pass on that background. Use it before introducing a pairing the system does not already promise. Works without a kaava.json when both colors are CSS colors.
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": "kaava_check_contrast"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| use | No | What the foreground is: "text" (default), "large-text" (24px, or 18.66px bold, and up), or "ui" (icons, borders, focus rings). | |
| mode | No | Theme used to resolve semantic color tokens. Default light. | |
| level | No | Conformance level to test against. Default AA. | |
| background | Yes | The color behind it: a CSS color or a token. | |
| foreground | Yes | Text, icon or border color: a CSS color or a token. | |
| projectRoot | No | Absolute path of the project. Defaults to the first workspace root the client exposes, else the server working directory. |