What is prefers-color-scheme?
Definitionprefers-color-scheme is a CSS media feature that websites use in media queries to detect whether a visitor's device is set to a light or dark color theme, so they can adjust their colors to match.
A CSS stylesheet can define default colors and then override them inside a media query for the dark value, or the reverse. Browsers read the setting from the operating system or from the browser's own theme. JavaScript can check the same preference with the matchMedia method and react when the user switches themes.
Chrome, Firefox and Safari all added support in 2019, which made dark mode for websites practical. Respecting the preference can make reading more comfortable for people who use dark mode, and pairing it with the color-scheme property tells the browser to style built-in elements such as form controls and scrollbars to match.
prefers-color-scheme resources
Topic: Web development
Cite this definition
- APA
What is prefers-color-scheme? (2026, November 22). Glossary. https://glossary.io/prefers-color-scheme/
- MLA
“What Is prefers-color-scheme?” Glossary, Coywolf, 22 Nov. 2026, glossary.io/prefers-color-scheme/.
- Chicago
“What Is prefers-color-scheme?” Glossary. Coywolf. November 22, 2026. https://glossary.io/prefers-color-scheme/.
- HTML link
<a href="https://glossary.io/prefers-color-scheme/">What is prefers-color-scheme?</a>
Published