Skip to content
Utilerio
All endpoints

Color Contrast Checker

POST/api/v1/tools/color-contrast-checker

Check whether a text and background color pair meets WCAG AA or AAA contrast.

Authentication

Requires an API key in the X-API-Key header.

Try it

POST/api/v1/tools/color-contrast-checker

Parameters

foregroundstringrequired

Foreground (text) color, hex (#rgb or #rrggbb).

backgroundstringrequired

Background color, hex (#rgb or #rrggbb).

Request body

{
  "foreground": "#1a1a1a",
  "background": "#ffffff"
}

Response codes

  • 200Success.
  • 400Invalid request — check your body or parameters.
  • 401Missing or invalid API key.
  • 403The API key is not scoped to this endpoint.
  • 429Rate limit exceeded — retry after a short wait.

Language

cURL

Request

curl -X POST https://utilerio.com/api/v1/tools/color-contrast-checker \
  -H "X-API-Key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"foreground":"#1a1a1a","background":"#ffffff"}'

Response

{ "ratio": 17.4, "aaNormal": true, "aaLarge": true, "aaaNormal": true, "aaaLarge": true }