Simplify handling of release roadmap image class#2046
Merged
sabderemane merged 1 commit intodjango:mainfrom May 4, 2025
Merged
Conversation
Due to the fact that a cookie can override the user's system setting for dark mode, the class on the release roadmap image was being managed by JavaScript. However, we can detect all cases in CSS since the `setTheme` JavaScript function has updated the `data-theme` attribute on the `body` tag in all cases. This patch also groups all CSS related to the release roadmap image together in `_dark-mode.scss`.
adamzap
commented
Apr 21, 2025
|
|
||
| .img-release { | ||
| &.light { | ||
| html[data-theme="light"] .img-release { |
Member
Author
There was a problem hiding this comment.
These four cases should cover everything:
- Explicit light
- Explicit dark
- Auto light
- Auto dark
sabderemane
approved these changes
May 4, 2025
Member
sabderemane
left a comment
There was a problem hiding this comment.
Looks good to me, thank you for the refactoring, definitely better like that ⭐
Member
Since I did the work I can answer, the image is generated in a way we currently can't. It was the only way to make the image not hard to read in dark theme. |
Member
Author
|
Ok thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Due to the fact that a cookie can override the user's system setting for dark mode, the class on the release roadmap image was being managed by JavaScript.
However, we can detect all cases in CSS since the
setThemeJavaScript function has updated thedata-themeattribute on thebodytag in all cases.This patch also groups all CSS related to the release roadmap image together in
_dark-mode.scss.To test this, go to the download page and observe the image with all combinations of the site theme options and your system theme options.
I was assessing a refactor for
switch-dark-mode.jsand found this opportunity to simplify things. I wonder if we could further simplify the handling of this image, and I'll probably open an issue about that eventually.