fix_contrast
Adjusts a foreground or background color to meet a WCAG 2.x or APCA contrast target while preserving hue, eliminating trial-and-error color selection.
Instructions
Automatically find the perceptually closest color that meets a WCAG 2.x or APCA contrast target while preserving hue in HCT space. Eliminates trial-and-error guessing.
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": {
"background": "<background>",
"foreground": "<foreground>"
},
"name": "fix_contrast"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| adjust | No | Which color to adjust: 'foreground' (default), 'background', or 'auto' (whichever needs smaller ΔE2000) | foreground |
| prefer | No | Direction preference for tone adjustment | minimal |
| target | No | Contrast target: 'aa' (4.5:1), 'aaa' (7:1), 'aa-large' (3:1), 'ui' (3:1), 'apca-body' (|Lc|≥75), 'apca-content' (|Lc|≥60), 'apca-large' (|Lc|≥45) | aa |
| background | Yes | Background color | |
| foreground | Yes | Foreground/text color |