# WCAG Color Contrast Ratio Calculator

> WCAG Color Contrast Ratio Calculator is a paid API for AI agents from x402-zoo.lolagent.workers.dev, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-14).

Calculates the contrast ratio between two HEX colors and evaluates WCAG AA and AAA accessibility thresholds for text.

## Facts

- Endpoint: GET https://x402-zoo.lolagent.workers.dev/api/color-contrast
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/wcag-color-contrast-ratio-calculator-db6d8197
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_Xvz1CNP9bEmhwXxHfEQtQ

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-calculator-db6d8197
```

Example prompt: Can you check whether white text (#FFFFFF) on a dark blue background (#1A2B6D) passes WCAG AA and AAA contrast standards?

## When to prefer this

Use this endpoint when you need a quick, deterministic WCAG contrast ratio check for two specific HEX colors, especially during UI/UX design, automated accessibility audits, or CI/CD pipelines. Prefer this over manual calculations or browser dev tools when building automated accessibility workflows.

## Known failure modes

- Invalid or missing HEX color values return an error
- HEX colors provided without # prefix may be rejected or misinterpreted
- Non-HEX color formats (RGB, HSL, named colors) are not supported
- Missing foreground or background parameter causes a validation error

## How this service works

Calculate contrast ratio between two HEX colors and evaluate WCAG AA and AAA text thresholds.

## Output

Returns the computed contrast ratio (a number like 4.5:1) between the two HEX colors, along with boolean pass/fail results for WCAG AA (minimum 4.5:1 for normal text) and AAA (7:1) thresholds, enabling accessibility compliance decisions.

## 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": [],
     "properties": {
      "background": {
       "type": "string"
      },
      "foreground": {
       "type": "string"
      }
     }
    }
   },
   "additionalProperties": false
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/wcag-color-contrast-ratio-calculator-db6d8197/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402-zoo.lolagent.workers.dev](https://www.zero.xyz/host/x402-zoo.lolagent.workers.dev/llms.txt)
