{"uid":"cap_FiTmnaq7V6yHoPXI3ehUq","slug":"wcag-contrast-fix-adjust-text-color-lightness-to-meet-contrast-target-87f461d6","name":"WCAG Contrast Fix — Adjust Text Color Lightness to Meet Contrast Target","description":"Adjust a text color's lightness just enough to reach a WCAG contrast target (4.5, 3 or 7) on a background, keeping its hue.","url":"https://color-design.x402tookit.com/contrast-fix?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET"],"type":"string"},"queryParams":{"type":"object","required":["foreground","background"],"properties":{"target":{"type":"number","description":"Contrast target: 3, 4.5 (default) or 7"},"background":{"type":"string","description":"Background hex"},"foreground":{"type":"string","description":"Text color hex"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","properties":{"asOf":{"type":["null","string"]},"fixed":{"type":["null","string"]},"source":{"type":["null","string"]},"target":{"type":["null","number"]},"reasons":{"type":["array","null"],"items":{"type":"string"}},"summary":{"type":["null","string"]},"verdict":{"type":["null","string"]},"degraded":{"type":["boolean","null"]},"original":{"type":["null","string"]},"background":{"type":["null","string"]},"disclaimer":{"type":["null","string"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}},"contrastAfter":{"type":["null","number"]},"contrastBefore":{"type":["null","number"]},"lightnessShift":{"type":["null","number"]}}}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.02","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.02/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_Cm5rJdOSeH56ZwKuyTjOh","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.02","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Adjusts a text color's lightness to reach a specified WCAG contrast ratio (3, 4.5, or 7) against a given background, preserving its original hue.","exampleAgentPrompt":"My text is #3a6bcf on a #ffffff background and it's failing accessibility — can you adjust its lightness just enough to hit a 4.5:1 WCAG contrast ratio while keeping the same blue hue?","exampleUseCases":[{"title":"Fix brand color for AA compliance","prompt":"My brand blue is #4a90d9 and I'm using it as text on a white (#ffffff) background — it's failing WCAG AA. Can you nudge its lightness until it reaches a 4.5 contrast ratio without changing the hue?"},{"title":"Achieve AAA contrast for legal disclaimer","prompt":"I need my disclaimer text (#888888) on a dark background (#1c1c1c) to hit a WCAG contrast target of 7 for AAA compliance. Can you fix the text color's lightness to get there while keeping the same gray tone?"},{"title":"Quick contrast check and fix for UI button","prompt":"The label color on my CTA button is #e05c5c and the button background is #ff9999 — please adjust the text color's lightness to at least meet the 3:1 contrast minimum for large text, keeping the same red hue."}],"resultDescription":"Returns the original and corrected foreground hex, contrast ratios before and after the fix, lightness shift applied, the WCAG target used, a verdict on compliance, a human-readable summary, reasons for any adjustments, and flags for degraded or unchecked conditions.","failureModes":["Invalid hex format for foreground or background returns an error","Contrast target not 3, 4.5, or 7 may be rejected or defaulted","Color may already pass — fixed value equals original with contrastBefore >= target","If no lightness adjustment can reach the target (e.g. pure hue limits), degraded flag may be set","Missing required foreground or background parameters returns a validation error"],"whenToPreferThis":"Choose this endpoint when you need a minimal, hue-preserving correction to a text color to meet a specific WCAG contrast threshold — not a full palette regen, color picker, or generic contrast checker. Ideal for automated accessibility remediation pipelines where brand hue must be preserved and only lightness should change.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-29T13:13:47.382Z","isFirstParty":false,"canonicalSlug":"wcag-contrast-fix-adjust-text-color-lightness-to-meet-contrast-target-87f461d6"}