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.
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 |