# WCAG Color Contrast Ratio Checker

> WCAG Color Contrast Ratio Checker is a paid API for AI agents from agent402.tools, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-15).

Computes the WCAG 2.x contrast ratio between a foreground and background color and returns AA/AAA pass/fail results for normal and large text.

## Facts

- Endpoint: POST https://agent402.tools/api/color-contrast
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/wcag-color-contrast-ratio-checker-c5b91329
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_KJC7t5SdvwNr21B8CbmTt

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability wcag-color-contrast-ratio-checker-c5b91329 -d '<json body>'
```

Example prompt: What's the WCAG contrast ratio between a background of #1a1a2e and foreground text of #e0e0e0 — does it pass AA and AAA for both normal and large text?

## When to prefer this

Use this endpoint when you need a deterministic, standards-compliant WCAG 2.x contrast ratio calculation without relying on a vision model or manual lookup — especially useful in design automation pipelines, accessibility audits, or CI checks for UI components.

## Known failure modes

- Invalid hex color format returns a 400 error
- Missing foreground or background field returns validation error
- Malformed #rgb shorthand not expanded correctly may cause parse error

## How this service works

Compute the WCAG 2.x contrast ratio between two colors (hex #rgb or #rrggbb) and whether it passes AA/AAA for normal and large text. Deterministic — for accessible color choices without a tool in the loop.

## Output

Returns the numeric WCAG 2.x contrast ratio and boolean pass/fail results for AA (4.5:1 normal, 3:1 large) and AAA (7:1 normal, 4.5:1 large) conformance levels for both normal and large text sizes.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "background": {
   "type": "string",
   "description": "background color (#rgb or #rrggbb)"
  },
  "foreground": {
   "type": "string",
   "description": "text color (#rgb or #rrggbb)"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "AA": {
   "large": true,
   "normal": false
  },
  "AAA": {
   "large": false,
   "normal": false
  },
  "ratio": 4.48
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/wcag-color-contrast-ratio-checker-c5b91329/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agent402.tools](https://www.zero.xyz/host/agent402.tools/llms.txt)
