
Given these guidelines, I've found the following strategy useful for constructing dark and light color palettes.

For example, to indicate that a modal sits on top of the page, its background color should be lighter than the background color of the section behind it. Based on Chethan KVS's excellent article on designing a dark theme, which is itself based on the principles of Material Design, the gist is that darker shades should be reserved for surfaces at the back of the page, with lighter and lighter shades used as you approach the front. This means that you may need different primary or brand colors for each palette.Ī second consideration is visual hierarchy. Many colors will not be interchangeable between modes. Most importantly, you need to ensure that colors on both palettes meet contrast requirements for accessibility. Switching between a dark color palette and a light one involves more than just switching between darker and lighter background colors. You just switch modes and, oh my Zsh, Dark Mode saves a marriage, again. Perhaps you're browsing Reddit in bed beside your trying-to-sleep spouse who complains about the light from your 32-inch laptop. A user might even prefer to use different modes at different times of day or depending on their location. The preference for either mode is subjective. Dark Mode? Apple IIe and Bank Street Writer by Mark Mathosianĭespite the vociferous support of some, Dark Mode is not held to be superior by all. Light Mode A long-standing but not immemorial default, in which a UI uses a lighter color palette. UI/UX Considerations Definitions Dark Mode A UI that generally uses a darker color palette Respecting the OS-Level Color-Scheme Preference (and Letting the User Override That Preference).Toggling between Dark/Light Mode with JavaScript.Defining a Dark/Light UI with CSS Custom Properties.I offer what I've found to be the best practices for implementing a dark mode toggle, and I look forward to refining these practices with suggestions, criticisms, and comments from the community. This post aims to cover all 10 points (some better than others). See who else is building Dark Mode toggles.Build a theme switcher, including gotchas.Let the user have ultimate say over color preference.Show how JavaScript can know about the OS-level choice.Explain that Dark Mode can happen at the operating system level itself.Recently, Chris Coyier at CSS-Tricks threw down the gauntlet for anyone who was about "to write a blog post about dark mode." He listed 10 points that would need to be covered:


In this article, I provide a complete guide to adding Dark Mode to your website. You may have noticed that Dark Mode is becoming more and more a thing.
