Smashing Magazine - #308: Designing and Building Dark Mode

With a complete guide to dark mode, designing in Figma and Sketch, how to choose colors and implementation details for dark mode. Issue #308 July 6, 2021 View in the browser 💨

Smashing Newsletter

Hailō dōsatō,

What used to be a rare feature just a few years ago, slowly becoming a common expectation these days: the dark mode. While many of us find light mode easier on the eyes, the moment I switched to the Cobalt Next theme in VS Code, I was never able to head back. But of course, that’s a matter of personal preference.

Cobalt Next, Dark Mode Theme

There is no shortage of tutorials around dark mode, from desktop apps and mobile apps to websites and emails. But how do we actually get started? Well, let’s figure it out!

For this newsletter, we’ve collected a couple of useful resources on dark mode, from tutorials to case studies, and we will be publishing a lengthier guide to dark mode on Smashing Magazine soon after.

Smashing Meets: CSS Summer
Surfing together: let’s dive into everything CSS Container Queries at our online meet-up, this Thu, July 8. Get your free ticket.

In the meantime, we are getting ready for our upcoming Smashing Meets: a free online meet-up on Thu, July 8, 8 AM SF / 5 PM Berlin. With two sessions on CSS container queries, by Miriam Suzanne and Ahmad Shadeed — we sincerely hope to see you there, of course! :-)

Stay smashing — dark or light!
Vitaly (@smashingmag)


1. A Complete Guide To Dark Mode On The Web

What do you need to consider if you want to implement a dark mode on your website? Mohamed Adhuham’s complete guide to dark mode on the web delves into different approaches and the technical considerations they entail.

A Complete Guide to Dark Mode on the Web

To get you started, the guide looks into different scenarios of toggling themes, which method to choose, and how you can let the user’s operating system do the lifting. Once that foundation is set, you’ll learn how to store a user’s preferences and how to handle user agent styles.

All of this will then be combined into building a working demo. Design considerations for images, shadows, typography, icons, and colors are also covered. A fantastic primer. (cm)


2. Design A Dark Theme With Material Design And Figma

Let’s say you want to build a dark mode theme for an existing Material Design app. How do you proceed? In his Google Codelab “Design a dark theme with Material and Figma”, Liam Spradlin walks you through the process step by step.

Design a dark theme with Material and Figma

The Codelab uses an email app as an example. There’s a Figma file that you can download and tips for setting up your design environment help you get started. In the first step, you’ll learn to understand the identity of the product so that you can make informed decisions about the dark theme.

Then you’ll dive right in, adjusting surface, text, and component colors. To reemphasize the app’s personality, the Codelab also looks into how to work with custom surface colors that go beyond the classic dark theme. A handy framework for understanding and defining your own product’s dark theme. (cm)


From our sponsor

Scale Your Business With A CMS Designed To Drive Growth

HubSpot
CMS Hub is powered by HubSpot’s CRM platform, meaning you can build websites that seamlessly integrate with the data your sales and marketing teams use to grow relationships with customers. Work with the tools and frameworks you prefer to create web experiences featuring personalization, automation, and dynamic content. Learn more →


3. How To Design Delightful Dark Themes

How to choose the colors for a dark theme? Simply reusing existing colors or inverting shades usually isn’t a good idea as it could increase eyestrain and make your design harder to use in low light. In the worst case, it may even break your visual hierarchy, as Teresa Man points out. In her article on the Superhuman blog, she shares a systematic way for designing dark themes that are readable, balanced, and delightful.

How To Design Delightful Dark Themes

The approach involves five steps: darken distant surfaces, revisit perceptual contrast, reduce large blocks of bright color, avoid pure black or white, and, last but not least, deepen colors. If you want to learn more about how to approach each step, Teresa looks at each one in more detail. A great guideline to follow along. (cm)


4. Upcoming Smashing Online Events

We are very proud and honored to invite you to our upcoming online event — Smashing Meetsthe CSSummer edition. The event will take place online, on July 8th, with sessions by Miriam Suzanne and Ahmad Shadeed on what’s happening in CSS — with a particular focus on CSS container queries. We’d love to see you there, as it will be good fun, of course!

Smashing Online Workshops

And if you’d like to dive deeper, we couldn’t be more excited for Stephanie’s Level-Up With Modern CSS workshop. We also have plenty of other topics to choose from. As always, here’s an overview of our upcoming front-end & design workshops.


5. The Quest For The Perfect Dark Mode

When Josh W. Comeau built his blog, the hardest part weren’t the live-embedded code snippets nor the GraphQL layer or the custom analytics system. It was dark mode. But why could something as seemingly straightforward turn out to become so complex?

The Quest for the Perfect Dark Mode

As Josh explains, it has to do with the fact that frameworks like Gatsby generate the HTML ahead of time. The effect: A short flicker that shows users the wrong colors for a brief moment. To help you circumvent the issue, Josh summarized how to build the perfect dark mode for Gatsby.js step by step.

The solution he comes up with meets all the criteria that makes for a delightful dark mode experience: A toggle allows the user to switch between light and dark mode, preferences are saved for future visits, it defaults to the preferred color scheme according to the user’s operating system, and, most importantly, there’s no flicker on first load and the site never shows the wrong toggle state. If you’re using Gatsby, Next.js, or any SSR app, this one’s for you. (cm)


From our sponsor

Build In-Demand Skills In Northwestern’s Online MS In Information Design And Strategy

Work at the Intersection of Data, Design and Technology. Earn your master’s degree online at Northwestern Information Design and Strategy.
Earn your master’s degree online.


6. Dark Mode For Email Marketers

Dark mode is also taking over the inbox. However, the way email clients handle dark mode of HTML emails varies significantly. Some don’t show any impact on color at all, others force default styles on your design or invert colors either partially or completely. To prevent you from bad surprises, Alice Li from the Litmus team put together a guide to dark mode for email marketers.

The Ultimate Guide to Dark Mode for Email Marketers

The guide takes a closer look not only at dark mode support and how different email clients apply dark mode to emails but also at two methods to target dark mode users with your own styles: with @media (prefers-color-scheme: dark) and by adding [data-ogsc] prefixes to each CSS rule. Valuable tips. (cm)


7. Switch Between Light And Dark Mode In Sketch

Wouldn’t it be nice if you could switch between light and dark mode color schemes as you design? Well, the free Color System plugin for Sketch makes it possible. It integrates seamlessly with your Document Colors, so that you can continue to work like you are used to. Just flip the switch to change the color scheme.

Color Systems plugin

There’s no need to create duplicate styles and duplicate elements. Once you have defined roles for each of your light mode colors, you only need to assign the dark mode colors to each role to be able to switch between the two. A real timesaver. (cm)


8. New On Smashing Job Board


9. Recent Smashing Articles


This newsletter issue was written and edited by Cosima Mielke (cm), Vitaly Friedman (vf) and Iris Lješnjanin (il).


Sent to truly smashing readers via Mailchimp.
We sincerely appreciate your kind support. You
rock.

Follow us on Twitter Join us on Facebook

unsubscribe update preferences view in your browser

Older messages

Next Online Workshops on CSS, Design Systems and UX

Thursday, July 1, 2021

Boost your skills online, with workshops on front-end and design. A bunch of new online workshops on front-end & design. • View in the browser 💨 SmashingConf Newsletter Howdy Smashing Friends, Meet

#307: CSS Tools, CSS Data Charts and Fluid Typography

Tuesday, June 29, 2021

With less-known but useful CSS tools that might come in handy for your projects. From fluid typography with clamp() to line-height calculator and CSS data charts, to general guidelines and resources

Smashing Newsletter #306: Front-End Accessibility

Tuesday, June 22, 2021

With accessible toggles, navigation, disabled buttons, hidden content and media scroller component. Applicable to your projects right away. Issue #306 • June 22, 2021 • View in the browser 💨 Smashing

Meet Image Optimization, A New Smashing Book

Thursday, June 17, 2021

Meet Addy Osmani's new book on image optimization: from formats and compression to delivery and maintenance. Brand new book: Image Optimization by Addy Osmani. Dearest Friend, How do we deliver

Smashing Newsletter #305: Color Palettes Generators and Tools

Tuesday, June 15, 2021

With CSS variables, HSLA, color generators, color combinations and color scales for data visualizations. Issue #305 • June 15, 2021 • View in the browser 💨 Smashing Newsletter Ciao Amici, Color may

You Might Also Like

Cascade, HTMX, Sponge Furniture, Meaning of Color, Flipbook

Friday, April 26, 2024

The 5 best design links, every day. Curated by a selection of great editors. Email not displaying properly? View browser version. Sidebar April 26 2024 A primer on the cascade and specificity piccalil.

9 Trends From Milan We Can’t Stop Thinking About

Thursday, April 25, 2024

View in your browser | Update your preferences ADPro Even More From Milan Design Week Each year, the design world convenes in Milan—and that applies to us at AD, too. For the third year running, our

Subframe, Attributes vs Properties, Front End Handbook, aspect-ratio, GenAI

Thursday, April 25, 2024

The 5 best design links, every day. Curated by a selection of great editors. Email not displaying properly? View browser version. Sidebar April 25 2024 Subframe subframe.com Subframe is a design-to-

Ritmo, Climate Change, Icons & Typefaces, Click Wheel JS, CarPlay

Wednesday, April 24, 2024

The 5 best design links, every day. Curated by a selection of great editors. Email not displaying properly? View browser version. Sidebar April 24 2024 Meet Ritmo, Musixmatch's cross-platform

Why Jake Arnold Doesn’t Text Clients

Tuesday, April 23, 2024

View in your browser | Update your preferences We've had a remodel! From now on, you'll be hearing from AD PRO in your inbox twice a week—once with a deep dive into trends to watch and subjects

The secret ingredient to media success

Tuesday, April 23, 2024

PR tips from our founder Nora Wolf In this month's edition is all about *the most important* element of successful media outreach—photography. You may have some photos, but if the backgrounds are

#453: Design Systems

Tuesday, April 23, 2024

Design system generator, types of design systems and how to consolidate design systems. Issue #453 • Apr 23, 2024 • View in the browser Smashing Newsletter Buổi tối vui vẻ Smashing Friends, Ah, design

👨‍🏫 Striking Educational Website Designs + 🏆 Challenge Updates

Tuesday, April 23, 2024

Your UpLabs Design Updates Await! Let's Get Going! 🎨 Firstly, let's congratulate Mariana Gameiro, the winner of our latest 👩‍💻 SheCodes Website Redesign Challenge! Congratulations!! Secondly,

Code Connect, JS Naked Day, Shape of AI, Product Design, CSS Grid Level 3

Tuesday, April 23, 2024

The 5 best design links, every day. Curated by a selection of great editors. Email not displaying properly? View browser version. Sidebar April 23 2024 The Right Code for Your Design System figma.com

Accessibility Weekly #393: When Security and Accessibility Clash

Monday, April 22, 2024

April 22, 2024 • Issue #393 View this issue online or browse the full issue archive. Featured: When security and accessibility clash: Why are banking applications so inaccessible? "While using