# Contrast Fixer: Nearest Accessible Color > Find the closest color that reaches WCAG 3:1, 4.5:1 or 7:1 contrast — and repair a palette. 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. Part of usefulweb.app (https://usefulweb.app/). Part of [Lumina](https://lumina.usefulweb.app/) (ownerApp: lumina). Results are deterministic calculations from the inputs and the listed assumptions; the API returns exactly what the web page shows. ## Use it - Human interface: https://luminacontrastfixer.usefulweb.app/ (interactive tool at https://luminacontrastfixer.usefulweb.app/tool) - JSON API: POST https://luminacontrastfixer.usefulweb.app/api/v1/calculate with a JSON object of inputs (schema: https://luminacontrastfixer.usefulweb.app/api/v1/tool) - OpenAPI: https://luminacontrastfixer.usefulweb.app/openapi.json - MCP (Streamable HTTP): https://luminacontrastfixer.usefulweb.app/mcp - tool `lumina_contrast_fixer` ## Inputs - foreground (text): Text color (CSS color) - background (text): Background color (CSS color) - target (select): Contrast target - adjust (select): Color to change - palette (textarea): Palette to check (optional, 2–24 colors) ## Method - Contrast is the WCAG 2.x ratio (L1 + 0.05)/(L2 + 0.05) of relative luminances from 8-bit sRGB. Thresholds compare unrounded ratios; every suggestion is checked again on its rounded HEX value. - Only the chosen color changes. Its OKLCH hue and chroma are kept and its lightness is moved towards black (darker) and towards white (lighter) by bisection until the target is just reached; chroma is reduced by the CSS Color 4 gamut mapping if the color would leave sRGB. - The suggestion is the option with the smaller CIEDE2000 difference to the original. Black or white is offered only when neither direction can reach the target. - Palette check: for each color as background, the other palette colors that pass are listed (best ratio first). If none passes, the palette color with the highest ratio is adjusted as above. APCA is not used.