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
POST https://luminacontrastfixer.usefulweb.app/api/v1/calculate– run Contrast Fixer: Nearest Accessible ColorGET https://luminacontrastfixer.usefulweb.app/api/v1/tool– inputs, output schema, examples- OpenAPI 3.1: /openapi.json · /openapi.yaml
- Errors:
application/problem+json;422includes per-fielderrors.
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.
| Field | Type | Default | Description |
|---|---|---|---|
foreground | text | "#72A5A0" | Text color (CSS color) |
background | text | "#ECF0DE" | Background color (CSS color) |
target | select (3, 4.5, 7) | "4.5" | Contrast target |
adjust | select (foreground, background) | "foreground" | Color to change |
palette | textarea | — | 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)
- Streamable HTTP endpoint:
https://luminacontrastfixer.usefulweb.app/mcp– protocol revisions 2026-07-28 (stateless) and 2025-11-25 / 2025-06-18 / 2025-03-26 (initialize handshake). - Tools:
lumina_contrast_fixer - Local stdio connector:
node src/mcp-stdio.ts --tool=lumina-contrast-fixer
{
"mcpServers": {
"lumina-contrast-fixer": { "type": "http", "url": "https://luminacontrastfixer.usefulweb.app/mcp" }
}
}