r/codesnip • u/wanoo21 • Aug 17 '26
The web just got a little more intelligent.
Meet `contrast-color()`: You give it any color; it returns either `black` or `white`, whichever provides better contrast.
Shipped in Chrome 147, Safari 26, Firefox 146, and Edge 147 (April 2026).
Pure CSS that guarantees readable text.
PS. If you want occasional frontend tips in your inbox, you can join here: https://bits.iprodan.dev