July 9, 2022
When building dark mode into a website, itâs tempting to invert the gray color scale across the site. Everything thatâs white becomes black, and the in-between shades flip.
This makes sense: light gray text on a white background (barely visible, de-emphasized text) becomes dark gray on a black background (similarly de-emphasized!).
But when these shades of gray are being used elsewhere in the app, this simple flip stops working.
Hereâs a fairly standard login page. Itâs a small page, so weâre concentrating the content in a small card in the middle of the screen. Thereâs some secondary content, like a link to the âforgot passwordâ page, so weâve added a second card underneath for that.
Generally, lighter elements feel closer to us and darker objects feel further away. So weâve made the main card lighter than the background, and the secondary little card darker to emphasize that itâs not the main focus of the page. We want the viewerâs eye to be drawn to the white card, and only to the smaller card below if theyâre searching for more things on the page.
If we just flip the gray colors for dark mode, this is what we end up with:
The hierarchy feels weird. The main card is completely black (since it used to be white) and feels like itâs sinking into the background, trying not to be seen. Tthe secondary card underneath is the lightest element, and your eye is immediately drawn to it even though itâs the least important part of the interface.
Unfortunately, I think the solution is to hand-assign each elementâs color separately for light and dark mode.
The right shade of gray needs to be chosen twice to make sure itâs still producing the intended effect in its context. The shortcut of globally flipping the color scale doesnât quite work.
Tufts Meal Plan Wrapped
Mar 2, 2024
Building an e-ink picture frame that displays an iCloud photo album
Jan 9, 2024
2023 in review
Jan 5, 2024
Subscribe to my newsletter for a monthly round-up of new blog posts and projects Iâm working on!