Color Scheme Property

Last updated: 2026-09-13

color-scheme Color Scheme Property

The color-scheme property tells the browser which color schemes (light/dark) an element supports, letting the browser pick suitable default colors for rendering the element's native controls such as scrollbars and form elements. It is an important property for dark-mode adaptation.

Category
Initial Valuenormal
InheritedYes
Applies To
Animation Type
CSS VersionCSS3
StatusStandard

📝 Syntax

color-scheme: normal | [ light | dark | <custom-ident> ]+ && only?;

⚙️ Values

ValueTypeDescription
normal | light | dark | onlyKeywordThe supported color schemes

▶ Example

Edit the code below and see the live result in the playground:

🌐 Browser Support

Browser ChromeChrome EdgeEdge FirefoxFirefox SafariSafari OperaOpera
color-scheme v79 v12 v52 v10.1 v44
Supported in all major browsers
Tip: Setting color-scheme: dark on the <html> or <body> lets the browser automatically render native elements like scrollbars and form controls in dark styles.
Tip: only means the element supports only the listed scheme and stops the browser from switching automatically; a light dark combination means both are supported.

❓ FAQ

QWhat is the difference between color-scheme and prefers-color-scheme?
Aprefers-color-scheme is a media query that detects the user's system light/dark preference and decides which stylesheet to load. color-scheme tells the browser which schemes the page or element supports, so it can pick default colors for native controls like scrollbars and forms. In practice they work together: the media query styles your custom colors, and color-scheme keeps native controls in sync.
QDoes an element automatically turn dark after setting color-scheme?
ANo — it does not change the colors you wrote yourself; it only affects the browser's default rendering of native UI such as scrollbars, inputs, dropdown menus, and placeholders. Backgrounds, text, and other custom colors still need to be set manually. For example, html { color-scheme: dark; background: #111; color: #eee; } is what fully renders a dark page.
QHow do I use the only keyword of the color-scheme property in CSS?
Aonly means supports only the listed schemes, no automatic switching. For example, color-scheme: only dark forces the native controls to always render dark, even when the system is in light mode. color-scheme: light dark means both are supported and it follows the system. only fits branded, content-creation pages. The default normal follows the user agent and system settings.
QWhat is the difference between color-scheme and the meta theme-color?
Atheme-color is an HTML meta tag that controls the color of the browser UI shell — the mobile address bar and the window theme color. color-scheme is a CSS property that controls the light/dark rendering of native controls inside the page. They target different layers: one manages the browser chrome, the other the page content. When building dark mode you can set both for a consistent inside-and-out look.

📚 Related Tutorials

Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏