Accessible Palette Checker API
Adjust the lightness of palette colours as little as possible (in OKLCH, hue kept) until chosen foreground/background pairs meet a WCAG contrast target.
POST /api/v1/tools/palette-contrast-fixerMCP palette_contrast_fixerDesign & ColourCheck every text and background pair in your palette against WCAG AA and AAA, then fix failing pairs by nudging OKLCH lightness as little as possible.
Input
Send these as a JSON object. Unknown fields are rejected.
- colors
- 2 to 10 colours, one per line or comma-separated (hex, rgb(), hsl() or names). They are numbered from 1 in this order. (string, up to 2000 characters, required)
- pairs
- Pairs to fix as 1-based colour numbers, comma-separated, e.g. "1-2, 1-3" (text colour 1 on background 2 and 3). (string, up to 500 characters, required)
- adjustable
- Colour numbers allowed to change, comma-separated, e.g. "1". Default: every colour. (string, up to 100 characters)
- target
- aa: AA, normal text (4.5:1); aa-large: AA, large text and UI (3:1); aaa: AAA, normal text (7:1). (string, one of aa, aa-large, aaa, default "aa")
curl https://pithlab.com/api/v1/tools/palette-contrast-fixer \n -H "Authorization: Bearer $PITHLAB_KEY" \n -H "Content-Type: application/json" \n -d '{"colors":"#777777, #ffffff, #f1f5f9","pairs":"1-2, 1-3","adjustable":"1","target":"aa"}'Example response
{
"ok": true,
"result": {
"colors": [
"#707070",
"#ffffff",
"#f1f5f9"
],
"changes": [
{
"color": 1,
"before": "#777777",
"after": "#707070",
"deltaL": -0.0241
}
],
"pairs": [
{
"foreground": 1,
"background": 2,
"before": "4.47:1",
"after": "4.95:1",
"level": "AA",
"passes": true
},
{
"foreground": 1,
"background": 3,
"before": "4.08:1",
"after": "4.52:1",
"level": "AA",
"passes": true
}
],
"allPass": true
}
}