Check the WCAG contrast of a text and background color
swatch_check_contrastUse when the user asks whether a color combination is readable or accessible, passes WCAG AA or AAA, or has enough contrast (text on a background, button, badge, link color). Returns the exact contrast ratio, pass or fail for normal text, large text and UI components at AA and AAA, the APCA lightness contrast and a plain note. Colors can be hex, rgb(), hsl() or CSS names. Example: {"foreground": "#777777", "background": "#ffffff"}. Language models cannot compute this reliably, so call it instead of guessing.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| background | Yes | Background color, e.g. "#ffffff". | |
| foreground | Yes | Text (or icon) color, e.g. "#767676" or "rgb(20 20 20)" or "tomato". |