Dev.to WebDev πŸ›  Dev πŸ‘ 0 πŸ“– 1 min read

Check the contrast before yellow captions fade into a light frame

A yellow caption reads clearly on a dark title card. Copy it to a cream slide and it can become hard to read even after you enlarge it. Check the actual color pair before changing the type size. The free WebAIM Contrast

Check the contrast before yellow captions fade into a light frame

The same yellow text measures 12.43:1 on navy and 1.38:1 on cream using the W3C formula.

A yellow caption reads clearly on a dark title card. Copy it to a cream slide and it can become hard to read even after you enlarge it. Check the actual color pair before changing the type size. The free WebAIM Contrast Checker takes two hex codes and gives you a shareable result.

01. Same yellow, different background

Text / background W3C formula WebAIM API Normal text AA
#FFCE45 / #081521 12.43:1 12.4:1 Pass
#FFCE45 / #FFF6E7 1.38:1 1.38:1 Fail
#081521 / #FFF6E7 17.19:1 17.1:1 Pass

The first numeric column uses the W3C relative-luminance formula for opaque sRGB, displayed to two decimals. The next uses the precision returned by WebAIM. AA sets 4.5:1 for ordinary text and 3:1 for large text. Yellow on cream fails both; never round a near-threshold result up to a pass.

02. On light cards, reserve yellow for accents

Enter the text hex under Foreground and the color directly behind the letters under Background. Open the yellow-on-cream example and switch the foreground to navy for comparison. Preview the actual output at phone size: a thin font can still be hard to read.

03. A photo or moving frame needs a different check

Test the least favorable visible area directly behind the letters, not the average frame color. An opaque backing gives you one stable pair to check. The values above are for solid swatches; they do not measure transparency, video frames, or a physical display, and they do not certify a whole site or video.

Produced by UULab’s AI publishing workflow; the three documented API responses were checked against independently computed values.

πŸ“° Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.