-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FEATURE: automatic dark mode #10341
FEATURE: automatic dark mode #10341
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am going to trust the search/replace process here because there are 142 files changed and that's impossible to do by eye. It does look very clean and elegant though!
When pulling this locally I see
Possibly because my color scheme name has a space in it? |
Yes, because of the space. I'll fix. |
b1437e7
to
19eb7c4
Compare
With a new site I'm getting lib/stylesheet/manager.rb:
|
This is a first step to adding automatic dark mode color theme switching. It's only a v1, the feature will be fine-tuned in the near future.
Here's what the PR does. First, a new SCSS file is added at
color_definitions.scss
that serves to output all SCSS variables as CSS custom properties. This file is compiled and included in the app as a separate stylesheet.Next, the PR adds the
default_dark_mode_color_scheme_id
site setting, disabled by default and hidden for now. When a valid dark scheme id is set, the app loads a second stylesheet with the dark scheme's color definitions. When the browser/OS is in dark mode using(prefers-color-scheme: dark)
, the dark color scheme will apply.Last but not least, the PR mass replaces SCSS color variables with CSS custom properties, so that automatic dark mode switching can happen when enabled.