Find the nearest accessible color that passes contrast
swatch_fix_contrastUse when a color pair fails contrast and the user wants the smallest change that makes it pass, such as "make this gray text accessible without changing the look". Returns the closest text color on that background that reaches the target (AA, AAA, AA-large or ui), and separately the closest background, keeping the hue. Example: {"foreground": "#777777", "background": "#ffffff", "target": "AA"}. Returns already_passes if nothing needs to change.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| target | No | Contrast target. Default AA. | |
| background | Yes | Current background color. | |
| foreground | Yes | Current text color. |