# WCAG Color Contrast Ratio Calculator

> WCAG Color Contrast Ratio Calculator is a paid API for AI agents from api.x402node.dev, paid per call via x402, $0.008/call, status unknown (last checked 2026-09-15).

Calculates the WCAG 2.1 contrast ratio between two colors and returns pass/fail results for AA and AAA compliance at normal and large text sizes.

## Facts

- Endpoint: GET https://api.x402node.dev/color/contrast
- Price: $0.008/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/api-x402node-dev-071f8df7
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_zMQv0E0cVtzIizleY1JPM

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 api-x402node-dev-071f8df7
```

Example prompt: Check if #1a1a1a text on a #ffffff background passes WCAG 2.1 AA and AAA accessibility standards for both normal and large text, and tell me the contrast ratio.

## When to prefer this

Use this endpoint when you need a programmatic, standards-compliant WCAG 2.1 contrast ratio calculation with explicit AA/AAA pass/fail results for both normal and large text, especially in design review, accessibility auditing, or automated UI testing workflows.

## Known failure modes

- Invalid color format provided — returns error if hex codes or color values are malformed
- Missing required foreground or background color parameters
- Unsupported color format outside expected input schema

## How this service works

WCAG contrast ratio calculator, accessibility checker, color contrast, a11y, WCAG 2.1 AA AAA, text contrast, color blindness, readable text color. Calculate WCAG 2.1 contrast ratio between two colors and return pass/fail for AA/AAA at normal/large text sizes. Accepts payment on Base or Solana — either network works.

## Output

Returns the calculated contrast ratio (a number like 4.5:1) along with pass/fail status for WCAG AA and AAA compliance at both normal text and large text thresholds.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "fg"
     ],
     "properties": {
      "bg": {
       "type": "string",
       "description": "Background color (optional)"
      },
      "fg": {
       "type": "string",
       "description": "Foreground color (required)"
      }
     }
    }
   },
   "additionalProperties": false
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/api-x402node-dev-071f8df7/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.x402node.dev](https://www.zero.xyz/host/api.x402node.dev/llms.txt)
