# WritersLogic WCAG Contrast Checker & Fixer

> WritersLogic WCAG Contrast Checker & Fixer is a paid API for AI agents from agents.writerslogic.com, paid per call via x402, $0.005/call, status unknown (last checked 2026-11-18).

Validates foreground/background hex color pairs against WCAG 2.2 contrast ratios, returns fixed colors for failing pairs using OKLCH lightness adjustment, and optionally simulates color vision deficiencies

## Facts

- Endpoint: POST https://agents.writerslogic.com/api/v1/contrast-fix?utm_source=zero.xyz
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-18
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/writerslogic-wcag-contrast-checker-fixer-106e241c
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_Mm_6IAn5LL6mHUO5u__uH

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 writerslogic-wcag-contrast-checker-fixer-106e241c -d '<json body>'
```

Example prompt: Check these two color pairs for WCAG AA normal text compliance and fix any that fail by adjusting the foreground: #1a1a1a on #ffffff, and #777777 on #f0f0f0. Also run a protanomaly simulation at severity 0.8 to see if they stay distinguishable.

## When to prefer this

Use this endpoint when you need programmatic, batch WCAG 2.2 contrast validation and automatic color fixing in a single call, especially when generating or auditing design system palettes. It is the right choice when you need OKLCH-based color correction that preserves hue and chroma, or when you need to verify color distinguishability for color-blind users under specific CVD types and severities. Prefer this over manual tools or general LLM color advice when you need deterministic, standards-compliant ratio computation on the unrounded value. Not suitable for APCA contrast, opacity handling, gradients, or non-sRGB color spaces.

## Known failure modes

- Invalid hex color format (not #rgb or #rrggbb) returns a validation error
- Submitting more than 50 pairs returns a schema error
- Threshold or ratio outside 1–21 range is rejected
- No fix is possible if even pure black or white fails the threshold (edge case for extreme custom thresholds)
- CVD severity outside 0–1 range is rejected
- Colors with alpha channel or CSS color names are not accepted

## How this service works

Pay-per-call agents settled in USDC on Base via x402. Every response carries a signed provenance envelope.

## Output

For each submitted color pair: the unrounded contrast ratio, a pass/fail flag for the requested WCAG level, and (if failing and fixTarget is not 'none') the adjusted hex color (OKLCH lightness-shifted, chroma/hue preserved, gamut-clipped to 8-bit sRGB) that just meets the threshold. If CVD simulation is enabled, also returns whether the pair remains distinguishable under the specified color vision deficiency type at the given severity, using OKLab delta-E distance. The caller-supplied label is echoed back for each pair. If claimedRatio is supplied, a flag indicates whether it matches the computed ratio within 0.01.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "level": {
   "enum": [
    "aa-normal",
    "aa-large",
    "aaa-normal",
    "aaa-large",
    "non-text"
   ],
   "type": "string",
   "description": "aa-normal 4.5 (default), aa-large 3, aaa-normal 7, aaa-large 4.5, non-text 3 (WCAG 2.2 SC 1.4.3, 1.4.6, 1.4.11)."
  },
  "pairs": {
   "type": "array",
   "items": {
    "type": "object",
    "required": [
     "foreground",
     "background"
    ],
    "properties": {
     "label": {
      "type": "string",
      "maxLength": 80,
      "description": "Caller label echoed back."
     },
     "background": {
      "type": "string",
      "pattern": "^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$",
      "maxLength": 7,
      "description": "#rgb or #rrggbb."
     },
     "foreground": {
      "type": "string",
      "pattern": "^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$",
      "maxLength": 7,
      "description": "#rgb or #rrggbb (strict hex; no names, no alpha)."
     },
     "claimedRatio": {
      "type": "number",
      "maximum": 21,
      "minimum": 1,
      "description": "A ratio the caller asserts; compared to the unrounded ratio with a 0.01 tolerance."
     }
    }
   },
   "maxItems": 50,
   "minItems": 1,
   "description": "Foreground/background pairs."
  },
  "fixTarget": {
   "enum": [
    "foreground",
    "background",
    "none"
   ],
   "type": "string",
   "description": "Which colour to move for a failing pair (default foreground); none skips the fix."
  },
  "threshold": {
   "type": "number",
   "maximum": 21,
   "minimum": 1,
   "description": "Overrides level: the minimum contrast ratio."
  },
  "cvdSeverity": {
   "type": "number",
   "maximum": 1,
   "minimum": 0,
   "description": "Enables the colour-vision-deficiency check at this severity, 0 to 1 (1.0 is dichromacy); between the published 0.1 steps the matrices are interpolated."
  },
  "cvdMinDeltaE": {
   "type": "number",
   "maximum": 2,
   "minimum": 0,
   "description": "Smallest OKLab distance counted as distinguishable (default 0.05, a heuristic, not a standard)."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json"
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/writerslogic-wcag-contrast-checker-fixer-106e241c/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agents.writerslogic.com](https://www.zero.xyz/host/agents.writerslogic.com/llms.txt)
