WCAG Contrast Checker API (plus Color Conversion and Palettes)
Accessibility audits keep failing on contrast because it gets checked by eye. The WCAG 2.x formula is precise — automate it.
One GET returns the exact contrast ratio for any foreground/background pair with AA and AAA pass-fail for normal and large text. The same API converts any CSS color between formats and generates harmonious palettes.
Check contrast programmatically
curl -G "https://color-toolkit.p.rapidapi.com/contrast" \
--data-urlencode "foreground=#777777" --data-urlencode "background=#ffffff" \
-H "X-RapidAPI-Key: YOUR_KEY" \
-H "X-RapidAPI-Host: color-toolkit.p.rapidapi.com"Where to use it
Wire it into a design-system CI check (fail the build when a token pair drops below AA), a theme builder that validates user-picked colors live, or a CMS that warns editors when text/background combos are illegible. WCAG 2.x requires 4.5:1 for normal text (AA) and 7:1 for AAA.
Convert and generate palettes
GET /convert parses any hex, rgb(), hsl(), or CSS named color and returns it in every format (hex, RGB, HSL, HSV, CMYK) — handy for design-tool interop. GET /palette generates complementary, analogous, triadic, tetradic, or monochromatic palettes from a seed color, and GET /random returns random colors for placeholders and demos.
Run it in production
Color Toolkit has a permanent free tier — 1,000 requests a month, no credit card. Paid plans start at $5/month for 100,000 requests.
FAQ
Which WCAG version does the check use?
WCAG 2.x relative-luminance contrast, with pass/fail reported for AA and AAA at both normal and large text sizes.
What color inputs are accepted?
Hex (#777 or #777777), rgb()/rgba(), hsl()/hsla(), and CSS named colors.
Is anything stored?
No. It's pure computation — colors in, JSON out, nothing logged.