← Pablobot

Color contrast

Contrast ratio for text (foreground) on a solid background using sRGB relative luminance from WCAG 2.x. Deep link with ?fg= and ?bg= as URL-encoded hex (e.g. ?fg=%23f59e0b&bg=%231e293b).

Inputs

Use #RGB or #RRGGBB.

Results

Sample heading

Sample body text for quick visual check.

Formula matches WCAG 2.x: for each channel, CsRGB = Css/255; Clinear = CsRGB <= 0.03928 ? CsRGB/12.92 : ((CsRGB + 0.055) / 1.055) ^ 2.4. Contrast = (L1 + 0.05) / (L2 + 0.05) with lighter L as L1.