API & MCP

Everything a person can do on Contrast Fixer: Nearest Accessible Color, a program or AI agent can do with the same inputs and get the identical result.

HTTP API

Contrast Fixer: Nearest Accessible Color

Enter a text and a background color. If the pair fails the WCAG contrast target, get the nearest darker and lighter versions of the color you want to change (same OKLCH hue, measured by CIEDE2000). Optionally check a whole palette: every background gets its readable text colors and a repaired one where none passes.

Inputs of Contrast Fixer: Nearest Accessible Color
FieldTypeDefaultDescription
foregroundtext"#72A5A0"Text color (CSS color)
backgroundtext"#ECF0DE"Background color (CSS color)
targetselect (3, 4.5, 7)"4.5"Contrast target
adjustselect (foreground, background)"foreground"Color to change
palettetextarea—Palette to check (optional, 2–24 colors)

Example request

Sea green text on foam

curl -X POST https://luminacontrastfixer.usefulweb.app/api/v1/calculate -H 'content-type: application/json' -d '{"foreground":"#72A5A0","background":"#ECF0DE","target":"4.5","adjust":"foreground","palette":""}'

Every result contains

inputs (normalised, defaults applied), summary, result (validated against the published schema), units, assumptions, sources, warnings, computedAt and links.

MCP (Model Context Protocol)

{
  "mcpServers": {
    "lumina-contrast-fixer": { "type": "http", "url": "https://luminacontrastfixer.usefulweb.app/mcp" }
  }
}