This post has been republished via RSS; it originally appeared at: Windows Blog.
If you build a web application, chances are good that you’ve received user requests for dark mode support in the past couple of years. While some users may simply prefer the aesthetics of dark UI, others may find that dark mode helps ease eye strain or helps reduce screen brightness at night. To make it easier for websites to support a cohesive dark mode theme, Microsoft and Google have collaborated to bring support for dark mode form controls to Chromium. Dark mode controls are available in Microsoft Edge on desktop as of v87. More recent collaborations extend support to the Android platform: these changes will begin showing up in Chrome v91 for Android, and will be available in future versions of Microsoft Edge for Android. When the web developer expresses support for dark mode, and the user has this mode enabled, our user agent (UA) stylesheet will “auto-darken” form controls out-of-the-box:Light mode | Dark mode |
![]() |
![]() |
prefers-color-scheme
media query.
Here’s how you can take advantage of dark mode support for HTML form controls.
Render all document form controls in dark mode
A meta tag declaration with thecolor-scheme
name signals to the browser which color modes the web application supports. To tell the browser it is safe to render controls as light or dark, declare the following in the head of your document:
The browser will apply its user agent stylesheet to all controls in your document:

color-scheme
property:
:root { color-scheme: light dark; }Opting into both light and dark schemes on the
:root
means that all the controls in your document will pick up the active color scheme—essentially equivalent to the meta tag declaration.
Explore CSS color-scheme
example on Codepen
Render specific form controls in dark mode
Some web developers might need to apply dark color schemes only to some areas of their application. In such a case, you can continue to use the color-scheme CSS property, instead with a more specific selector:.schemed-area { color-scheme: light dark; }We’re targeting the
.schemed-area
div with our selector, so color-scheme specific UA styles will only cascade to this element and its descendants. Here’s what that looks like with dark mode enabled:

color-scheme
example on Codepen
With dark mode enabled on the system, no changes were applied to the contents in the “Default style area” box. Within the “Schemed area” box, the form controls were updated to dark mode aesthetics.
You may notice that—unlike opting into color schemes at the root—non-control contents in the “Schemed area” were unchanged by the user agent’s dark theme. Instead, web developers should manage text and background colors for the schemed area using the prefers-color-scheme
media query.
Share your feedback
We’re excited to make it a bit easier for web developers to support dark mode in Chromium, and are eager to hear what you think! If you run into any issues or have any feedback, use the in-app feedback button (or Alt+Shift+I). You can also reach out to us on Twitter. Thanks for your feedback!—Melanie Richards, Senior Program Manager —Sam Sebree, Software Engineer —Ionel Popescu, Software Engineer —Bo Cupp, Principal Software Engineer —Brian Heston, Senior Designer