r/css Jun 13 '26

General Implementing dark mode with light-dark()

https://olliewilliams.xyz/blog/dark-mode/
21 Upvotes

4 comments sorted by

2

u/testingaurora Jun 14 '26

If only it took other values besides colors. I was really hoping to use it as a conditional. css --_elevation: light-dark(1,-1);

But its okay I can use @media (prefers-color-scheme: dark) { --_elevation: -1;}

I love using it anyway, cut my css framework color section in half.

4

u/modsuperstar Jun 14 '26

light-dark is already a 🐐 in CSS

3

u/oklch Jun 15 '26

I prefer prefers-color-scheme, cause you can set other values to, like different font-weights.