![]() This meant storing our color values as var(-red-500) instead of a static This was an interesting problem in our design system, and the site in general. I needed to convert static, Less-compiled hex values to runtime custom CSS properties. If I had any hope of shipping dark mode to Stack Overflow, I’d first need to solve dark mode using Stacks, our design system, as a sandbox. The full normalized color gamut Adding the colors to Stacks With this approach, became with the values in the middle staying pretty much the same. ![]() In my first explorations of what Stack Overflow would look like in dark mode, I wanted to simply test swapping the white background for black, and reversing the color scales. ![]() This would lead us to a color scale represented by through with 10% steps in between. Then we’d tint to lighten a few times 10%) at the other end of the spectrum. For example, we’d define a Less variable, and darken it by 10% a few times using 10%). When building our product’s original color scales, we-perhaps naively-took a single color value and modified it using Less color transformations. We could give our users dark mode and offer future accessibility modes for free? By solving everything along the way to dark mode, Stack Overflow would modernize its front-end codebase, enable accessibility-conscious theming, and push for adoption of our design system. The work I’m about to talk about was never about dark mode specifically, even though countless users asked for it. Things that are hard to manage on light screens like simultaneous contrast is even harder to manage against dark backgrounds.īut here I am, the guy who finally shipped dark mode on Stack Overflow. ![]() Light text on dark backgrounds is fatiguing to my eyes. It’s even harder to introduce depth with shadows and other visual cues. It’s hard to use the full spectrum of colors to express your interface. I often find the usable contrast to be way too low. I don’t actually prefer dark user interfaces. I help design all the interface components that get assembled into new features.įirst, a bit of irony. The same also applies to lighter variants of non-numbered color variables.I’m Aaron Shekey, Stack Overflow’s principal product designer on design systems. This is because the values don't represent lightness, but rather contrast with the background. When dark mode is enabled, the values of numbered color variables will be inverted from what they are with dark mode disabled- 900 being the lightest, and 025 or 050 being the darkest. A common refactor is replacing background-color: with background-color: var(-white) to make sure a legacy component is aware of dark mode when a deeper refactor isn’t possible. If working in a legacy context, referencing our colors as Less variables is preferred to Hex, though both are deprecated. Referencing the CSS variables directly will make sure dark mode is properly accounted for. If your layout can’t be built using atomic color classes, all stops are available as CSS variables. All stops are available as various text, background, and border color classes. Our colors are each available in a number of stops from dark to light- 900 being the darkest, and 025 or 050 being the lightest.
0 Comments
Leave a Reply. |