We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e94130b commit d8afe90Copy full SHA for d8afe90
content/til/2025-11-19-light-dark/2025-11-19-light-dark.mdx
@@ -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