color-scheme
Widely availableSince 202297% of users
Tells the browser which color themes (light, dark) the element can be rendered in. This automatically adjusts UI elements like scrollbars and form controls to match the theme.
What's modern
From web-features, MDN's browser data and our snippets, checked dailyModernIn every major browser since January 2022. Widely available since July 2024.
The old way and the modern waySee the snippet: Dark mode defaults without extra CSS →
Old way 9 lines
@media (prefers-color-scheme: dark) {
input, select, textarea, button {
background: #333;
color: #eee;
}
::-webkit-scrollbar {
...
}
}Modern 3 lines
:root {
color-scheme: light dark;
}Newer parts of color-scheme
only keywordBaseline Feb 2022, Widely Aug 2024
See how modern your own CSS is.Check your CSS →
Quick facts
- Initial value
normal- Inherited
- Yes
- Applies to
- all elements and text
- Animation type
- discrete
Quick example
:root {
/* Enables systemic dark mode support */
color-scheme: light dark;
}Values
normallightdarkRelated snippet
Dark mode defaults without extra CSSWorkflow →color-scheme browser support
BaselineWidely availableThis feature is well established and works across many devices and browser versions. It has been available across browsers since 2022.Safe to use without fallbacks.
Usage97%of people can use this3% use a browser without it.
Browsers
81+
96+
13+
81+Mobile
81+Android
96+Android
13+iOS