DEV Community

Discussion on: Make a Text Match Any Background Color

Collapse
 
link2twenty profile image
Andrew Bone

That's so cool! I remember doing some research a couple of years ago as something to potentially add to Dev 😊

Comment for #735

It may be worth checking the contrast and if it fails the aria spec setting the text to solid white or black, which would be calculated at the time.

w3.org/TR/WCAG20/#visual-audio-con... w3.org/TR/2008/REC-WCAG20-20081211...

I've thrown together a quick proof of concept, it's written in JS but I imagine you'd rather the backend handled it.

jsfiddle.net/link2twenty/jL52defu/

Collapse
 
joserfelix profile image
Jose Felix

This is awesome, thanks for the comment! This shows how important is to learn about contrast ratios and use it for creating an accessible experience.