-
Notifications
You must be signed in to change notification settings - Fork 11.6k
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
Added "follow system" option to theme toggle #2261
Added "follow system" option to theme toggle #2261
Conversation
Thanks for your solution. My only issue here is about the icon, but not really sure how to fix this. Usually the current icon is used as |
Just give a thought about this, and one possible solution to keep the icons consistent between them is to use another iconset for this specific part. What do you guys think about using tabler icons? More specifically, moon, sun, and sun-moon. It looks like this in the template: And it also supports usage via scss, so after purgecss does its part, only the used icons will be kept on the final css file. I managed to make this change, so I could update your PR with this. |
Nice! I find that sun-moon icon a little ugly, but it seems fine and it's nice to have it consistent. |
Yes, it is not the prettiest one, but at least keeps the consistency in the icons. I will apply the changes and wait for @alshedivat feedback. |
Signed-off-by: George Araujo <george.gcac@gmail.com>
Signed-off-by: George Araujo <george.gcac@gmail.com>
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.
LGTM, thanks for implementing this!
The theme toggle button now has a third option, which follows the user's system preferences. - In the code there's now a distinction between the theme setting (which can be "dark", "light" or "system") and the computed theme. - The theme setting is now stored as the "theme-setting" local storage variable. Since this is different from the old variable ("theme"), this will effectively reset all current user themes to the default "system". Maybe this is not what you want. - The "system" theme icon is currently a half circle symbol. - The toggle button now displays the current theme setting, rather than the next theme setting (as far as I know this is consistent with other sites which have three theme options). - `theme.js` is now loaded regardless of `site.enable_darkmode`. This is because other scripts which were always loaded relied on being able to determine the theme. `theme.js` no longer initialises the theme itself though; this only happens when `site.enable_darkmode`. - When the theme setting is "system", the theme will change immediately whenever the user changes their system theme. alshedivat#2261 --------- Signed-off-by: George Araujo <george.gcac@gmail.com> Co-authored-by: George Araujo <george.gcac@gmail.com>
Can you ask this in Q&A? This PR was already merged, also there it is easier for more people to find it. |
The theme toggle button now has a third option, which follows the user's system preferences. - In the code there's now a distinction between the theme setting (which can be "dark", "light" or "system") and the computed theme. - The theme setting is now stored as the "theme-setting" local storage variable. Since this is different from the old variable ("theme"), this will effectively reset all current user themes to the default "system". Maybe this is not what you want. - The "system" theme icon is currently a half circle symbol. - The toggle button now displays the current theme setting, rather than the next theme setting (as far as I know this is consistent with other sites which have three theme options). - `theme.js` is now loaded regardless of `site.enable_darkmode`. This is because other scripts which were always loaded relied on being able to determine the theme. `theme.js` no longer initialises the theme itself though; this only happens when `site.enable_darkmode`. - When the theme setting is "system", the theme will change immediately whenever the user changes their system theme. alshedivat#2261 --------- Signed-off-by: George Araujo <george.gcac@gmail.com> Co-authored-by: George Araujo <george.gcac@gmail.com>
The theme toggle button now has a third option, which follows the user's system preferences. - In the code there's now a distinction between the theme setting (which can be "dark", "light" or "system") and the computed theme. - The theme setting is now stored as the "theme-setting" local storage variable. Since this is different from the old variable ("theme"), this will effectively reset all current user themes to the default "system". Maybe this is not what you want. - The "system" theme icon is currently a half circle symbol. - The toggle button now displays the current theme setting, rather than the next theme setting (as far as I know this is consistent with other sites which have three theme options). - `theme.js` is now loaded regardless of `site.enable_darkmode`. This is because other scripts which were always loaded relied on being able to determine the theme. `theme.js` no longer initialises the theme itself though; this only happens when `site.enable_darkmode`. - When the theme setting is "system", the theme will change immediately whenever the user changes their system theme. alshedivat#2261 --------- Signed-off-by: George Araujo <george.gcac@gmail.com> Co-authored-by: George Araujo <george.gcac@gmail.com>
The theme toggle button now has a third option, which follows the user's system preferences. - In the code there's now a distinction between the theme setting (which can be "dark", "light" or "system") and the computed theme. - The theme setting is now stored as the "theme-setting" local storage variable. Since this is different from the old variable ("theme"), this will effectively reset all current user themes to the default "system". Maybe this is not what you want. - The "system" theme icon is currently a half circle symbol. - The toggle button now displays the current theme setting, rather than the next theme setting (as far as I know this is consistent with other sites which have three theme options). - `theme.js` is now loaded regardless of `site.enable_darkmode`. This is because other scripts which were always loaded relied on being able to determine the theme. `theme.js` no longer initialises the theme itself though; this only happens when `site.enable_darkmode`. - When the theme setting is "system", the theme will change immediately whenever the user changes their system theme. alshedivat#2261 --------- Signed-off-by: George Araujo <george.gcac@gmail.com> Co-authored-by: George Araujo <george.gcac@gmail.com>
The theme toggle button now has a third option, which follows the user's system preferences. - In the code there's now a distinction between the theme setting (which can be "dark", "light" or "system") and the computed theme. - The theme setting is now stored as the "theme-setting" local storage variable. Since this is different from the old variable ("theme"), this will effectively reset all current user themes to the default "system". Maybe this is not what you want. - The "system" theme icon is currently a half circle symbol. - The toggle button now displays the current theme setting, rather than the next theme setting (as far as I know this is consistent with other sites which have three theme options). - `theme.js` is now loaded regardless of `site.enable_darkmode`. This is because other scripts which were always loaded relied on being able to determine the theme. `theme.js` no longer initialises the theme itself though; this only happens when `site.enable_darkmode`. - When the theme setting is "system", the theme will change immediately whenever the user changes their system theme. alshedivat#2261 --------- Signed-off-by: George Araujo <george.gcac@gmail.com> Co-authored-by: George Araujo <george.gcac@gmail.com>
The theme toggle button now has a third option, which follows the user's system preferences. - In the code there's now a distinction between the theme setting (which can be "dark", "light" or "system") and the computed theme. - The theme setting is now stored as the "theme-setting" local storage variable. Since this is different from the old variable ("theme"), this will effectively reset all current user themes to the default "system". Maybe this is not what you want. - The "system" theme icon is currently a half circle symbol. - The toggle button now displays the current theme setting, rather than the next theme setting (as far as I know this is consistent with other sites which have three theme options). - `theme.js` is now loaded regardless of `site.enable_darkmode`. This is because other scripts which were always loaded relied on being able to determine the theme. `theme.js` no longer initialises the theme itself though; this only happens when `site.enable_darkmode`. - When the theme setting is "system", the theme will change immediately whenever the user changes their system theme. alshedivat#2261 --------- Signed-off-by: George Araujo <george.gcac@gmail.com> Co-authored-by: George Araujo <george.gcac@gmail.com>
The theme toggle button now has a third option, which follows the user's system preferences. - In the code there's now a distinction between the theme setting (which can be "dark", "light" or "system") and the computed theme. - The theme setting is now stored as the "theme-setting" local storage variable. Since this is different from the old variable ("theme"), this will effectively reset all current user themes to the default "system". Maybe this is not what you want. - The "system" theme icon is currently a half circle symbol. - The toggle button now displays the current theme setting, rather than the next theme setting (as far as I know this is consistent with other sites which have three theme options). - `theme.js` is now loaded regardless of `site.enable_darkmode`. This is because other scripts which were always loaded relied on being able to determine the theme. `theme.js` no longer initialises the theme itself though; this only happens when `site.enable_darkmode`. - When the theme setting is "system", the theme will change immediately whenever the user changes their system theme. alshedivat#2261 --------- Signed-off-by: George Araujo <george.gcac@gmail.com> Co-authored-by: George Araujo <george.gcac@gmail.com>
The theme toggle button now has a third option, which follows the user's system preferences.
theme.js
is now loaded regardless ofsite.enable_darkmode
. This is because other scripts which were always loaded relied on being able to determine the theme.theme.js
no longer initialises the theme itself though; this only happens whensite.enable_darkmode
.#2261