Reblogged by kornel ("Kornel"):
jensimmons@front-end.social ("Jen Simmons") wrote:
I used the `light-dark` function quite a lot in recent demos. It makes implementing dark mode so easy!
Drop this in your base styles:
```
:root {
color-scheme: light dark;
}
```
Then, any time you define a color, do it like this…. to assign the first color to light mode, and the second to the dark mode.
```
color: light-dark(#000, #fff);
background-color: light-dark(#fff, #999);
```
This will save you from writing lots of conditional code inside `prefers-color-scheme` media queries.