# WCAG 2.x sRGB Contrast Calculator

> WCAG 2.x sRGB Contrast Calculator is a paid API for AI agents from api.zfinia.com, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-14).

Calculates the WCAG 2.x sRGB contrast ratio for a caller-supplied pair of foreground and background colours.

## Facts

- Endpoint: POST https://api.zfinia.com/x402/v1/accessibility-contrast-calculator
- 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-2-x-srgb-contrast-calculator-eaf05ed4
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_O3XA6wF5dCbnIL27VSu6y

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-2-x-srgb-contrast-calculator-eaf05ed4 -d '<json body>'
```

Example prompt: Can you calculate the WCAG 2.x sRGB contrast ratio between a foreground colour of #1A1A1A and a background colour of #FFFFFF so I can check if it passes accessibility standards?

## When to prefer this

Choose this endpoint when you need a fast, deterministic, per-colour-pair WCAG 2.x sRGB contrast ratio calculation without needing a full accessibility audit tool. Ideal for design-time checks, CI pipelines validating colour tokens, or agent workflows that need to programmatically verify individual colour combinations meet minimum contrast thresholds before publishing UI assets.

## Known failure modes

- Invalid colour format provided (e.g. malformed hex or out-of-range sRGB values) — returns validation error
- Missing foreground or background colour in request body — returns bad request error
- Contrast ratio computable but no WCAG level claim made at interface-wide scope — result is per-pair only
- Network or service unavailability — returns 5xx error

## How this service works

Calculate WCAG 2.x sRGB contrast for one caller-supplied colour pair; no interface-wide accessibility claim is made.

## Output

Returns the computed WCAG 2.x sRGB contrast ratio (a numeric value between 1:1 and 21:1) for the supplied colour pair, along with pass/fail status against standard WCAG compliance thresholds (AA and/or AAA levels for normal and large text).

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "background": {
   "type": "string",
   "pattern": "^#[0-9a-fA-F]{6}$"
  },
  "foreground": {
   "type": "string",
   "pattern": "^#[0-9a-fA-F]{6}$"
  },
  "large_text": {
   "type": "boolean"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "wcag_aa": true,
  "wcag_aaa": true,
  "large_text": false,
  "request_id": "example-request",
  "service_id": "accessibility_contrast_calculator",
  "limitations": [
   "Calculation uses WCAG 2.x sRGB contrast; it does not assess full interface accessibility."
  ],
  "contrast_ratio": 21,
  "service_version": "1.0.0"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/wcag-2-x-srgb-contrast-calculator-eaf05ed4/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.zfinia.com](https://www.zero.xyz/host/api.zfinia.com/llms.txt)
