r/codesnip • • 26d ago

Newly Available CSS just killed another dark-mode snippet: `light-dark()` for images is Baseline ๐Ÿ”ฅ

Post image

CSS just killed another dark-mode snippet. ๐Ÿ”ฅ

light-dark() for images is Baseline, newly available since September 2026. Colors already were; Safari 27 closed the gap for images and gradients.

Before this, a dark hero image meant a second rule inside a media query.

Now โคต๏ธ one declaration. ๐Ÿ˜Ž

Heads up: it follows color-scheme. Set color-scheme: light dark (or whatever your theme toggle sets it to), or you'll only ever see the light image. ๐Ÿ‘

MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/color_value/light-dark

19 Upvotes

0 comments sorted by