check_contrast
Check color contrast ratios with WCAG 2.1 or APCA algorithms. Enter a foreground/background pair or scan your design tokens to identify contrast failures.
Instructions
Check color contrast ratios using WCAG 2.1 and/or APCA algorithms. Two modes: (1) provide explicit foreground + background colors, or (2) scan your token set for all foreground/background pairs and report failures.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| algorithm | No | Which algorithm(s) to use. Default: both. | |
| threshold | No | Minimum WCAG contrast ratio to consider passing (e.g. '4.5' for AA normal text). Only affects which pairs are flagged in scan mode. | |
| background | No | Background color value (hex, rgb, hsl). Required if 'foreground' is provided. | |
| foreground | No | Foreground color value (hex, rgb, hsl). If provided with 'background', checks that single pair. | |
| pathPrefix | No | When scanning tokens, only check pairs under this path prefix. Comma-separated for multiple. |