WCAG Contrast Check
Computes the WCAG 2.2 contrast ratio between two colours and reports AA and AAA pass or fail for normal, large and non-text content.
POST /v1/image/contrast-check $0.005 per call
Specification
- Endpoint
POST /v1/image/contrast-check- Price
- $0.005 per call · tier
basic_data - Payment
-
x402 on X Layer (chain 196) · settled in USDG or USDT0 · schemes
exact,aggr_deferred - Data source
- Local sandboxed processing of the uploaded image
- Timeout
- 60 seconds
- Max request
- 20 MB
- Version
1.0.0
Calling it
The first call returns a 402 with the payment challenge. Retry with a
signed authorisation in the X-PAYMENT header — see
the payment guide for the exact shape.
curl -i -X POST "https://api.dana-edu.pp.ua/v1/image/contrast-check" \
-H "content-type: application/json" \
-d '{ ... }' Response
Real output, captured by running this endpoint at build time — not written by hand. Volatile fields such as timestamps are elided. Captured 2026-07-30.
{
"foreground": "#767676",
"background": "#ffffff",
"contrast_ratio": 4.542,
"foreground_luminance": 0.18116,
"background_luminance": 1,
"wcag": {
"aa_normal": {
"description": "normal text (AA)",
"required": 4.5,
"passes": true,
"shortfall": 0
},
"aa_large": {
"description": "large text, 18pt or 14pt bold (AA)",
"required": 3,
"passes": true,
"shortfall": 0
},
"aaa_normal": {
"description": "normal text (AAA)",
"required": 7,
"passes": false,
"shortfall": 2.46
},
"aaa_large": {
"description": "large text (AAA)",
"required": 4.5,
"passes": true,
"shortfall": 0
},
"aa_non_text": {
"description": "UI components and graphics (AA)",
"required": 3,
"passes": true,
"shortfall": 0
}
},
"passes_count": 4,
"method": {
"formula": "(L_lighter + 0.05) / (L_darker + 0.05)",
"luminance": "WCAG relative luminance with the sRGB transfer function and its 0.03928 breakpoint, not a plain 2.2 gamma — the shortcut shifts ratios enough to flip a pass into a fail near 4.5:1",
"reference": "WCAG 2.2 success criteria 1.4.3, 1.4.6 and 1.4.11"
}
}
Every response is wrapped in the same envelope: data plus
warnings, sources, confidence,
informational_only and a measured processing_ms.
See the envelope reference.
Related endpoints
Image Resize
Resizes an image with aspect-ratio control, fit modes and high-quality Lanczos resampling.
Image Crop
Crops by explicit box, aspect ratio or centred region, with bounds validated against the source dimensions.
Image Compression
Compresses to a target quality or maximum byte size, reporting the achieved size and the quality actually used.
Image Format Conversion
Converts between PNG, JPEG, WebP, AVIF, TIFF, BMP and GIF, handling alpha and colour-profile conversion explicitly.