Design
WCAG contrast audit API
Computes the WCAG 2.1 contrast ratio between a foreground and background and reports AA/AAA pass for normal & large text, the 3:1 non-text/UI threshold, both relative luminances, and an overall rating. Answers 'Does this text pass WCAG AA?', 'What is the contrast ratio?'
Price$0.04per request
MethodPOST
Route/v1/design/wcag-contrast
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
accessibilitywcagcontrasta11yaaaaacolorratioluminancedesign
API URL
Integration docshttps://x402.hexl.dev/v1/design/wcag-contrastExample request
{
"foreground": "#777777",
"background": "#ffffff"
}Example response
{
"foreground": "#777777",
"background": "#ffffff",
"ratio": 4.48,
"ratioString": "4.48:1",
"relativeLuminance": {
"foreground": 0.1845,
"background": 1
},
"passes": {
"aaNormal": false,
"aaLarge": true,
"aaaNormal": false,
"aaaLarge": false,
"uiComponents": true
},
"rating": "AA Large",
"interpretation": "Contrast 4.48:1 meets AA Large."
}Input schema
{
"type": "object",
"required": [
"foreground",
"background"
],
"properties": {
"foreground": {
"type": "string",
"examples": [
"#777777"
]
},
"background": {
"type": "string",
"examples": [
"#ffffff"
]
}
}
}Output schema
{
"type": "object",
"additionalProperties": true
}