Skip to content

Commit d8afe90

Browse files
chore: new til
1 parent e94130b commit d8afe90

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
title: light-dark
3+
date: 2025-11-19
4+
tag: css
5+
---
6+
7+
TIL about the `light-dark` function in CSS! It allows us to set two color values for a property, returning one based on if the developer has set
8+
a light or dark color scheme or the user has requested a light or dark color scheme. 🤩
9+
10+
```css
11+
:root {
12+
color-scheme: light dark;
13+
}
14+
15+
body {
16+
color: light-dark(#333b3c, #efefec);
17+
background-color: light-dark(#efedea, #223a2c);
18+
}
19+
```
20+
21+
[Check it out](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/color_value/light-dark)

0 commit comments

Comments
 (0)