color

Use this when checking whether a text/background color pair meets WCAG 2.x accessibility contrast.

Use this when checking whether a text/background color pair meets WCAG 2.x accessibility contrast. Computes the relative-luminance contrast ratio (1-21, rounded to 2 decimals) and returns pass/fail booleans for normal and large text at AA and AAA levels (thresholds 4.5 / 7 / 3 / 4.5), plus a suggested passing foreground hex when normal-text AA fails (null when it already passes or none is found). Accepts 3- or 6-digit hex, with or without a leading '#'; echoed colors are normalized to 6-digit hex. Deterministic: same input, same output. Example: {foreground:'777', background:'fff'} -> ratio 4.48, normalAA false, largeAA true, suggestedForeground '#767676'.

post/v1/color_contrast

Request

  • Base URL: https://api.clean.tools
  • URL: https://api.clean.tools/v1/color_contrast
  • Auth: none declared

Request body

foregroundstring required

Foreground (text) color as a 3 or 6 digit HEX string, with or without a leading #, e.g. "#1a1a1a" or "777".

backgroundstring required

Background color as a 3 or 6 digit HEX string, with or without a leading #, e.g. "#ffffff" or "fff".

Response

Structured tool result.

toolstring

Changes

No recorded changes to this operation across all 1 revision of this API.