Skip to content
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

Fix doxygen-awesome dark mode #130

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hidmic
Copy link

@hidmic hidmic commented May 1, 2024

Precisely what the title says. CSS scoping for html elements was leaving a fair amount of rules behind, such as those for html.dark-mode elements. Also, some light theme appropriate coloring was tagged as !important. This patch fixes it all.

@hidmic hidmic requested a review from twodrops as a code owner May 1, 2024 14:26
Signed-off-by: Michel Hidalgo <[email protected]>
@twodrops
Copy link
Collaborator

twodrops commented May 2, 2024

@hidmic Thanks a lot for the PR :) Which theme did you test it with?
I tested it with the pydata theme used in this repo for demo and the changes seems to have impacted the light mode.

@aniketsalve22 Could you please test it with pydata theme used in the demo, rtd-theme and book-theme?

@hidmic
Copy link
Author

hidmic commented May 2, 2024

Which theme did you test it with?

I'm using the sphinx-book-theme but without many of the customizations you have in this repo.

@twodrops
Copy link
Collaborator

twodrops commented May 2, 2024

Alright. @aniketsalve22 I guess it then makes sense to test the changes without any of our customisations.
Also @Maetveis has achieved cool customisations here from which we can draw some inspiration.

@hidmic
Copy link
Author

hidmic commented May 2, 2024

AMD docs look pretty too. Don't mind which path we take so long as we can get the dark mode to work.

Great tool BTW.

@twodrops
Copy link
Collaborator

twodrops commented May 2, 2024

@aniketsalve22 Just realized we are using sphinx-book-theme for demo as well and not pydata-theme.

@Maetveis
Copy link
Contributor

Maetveis commented May 5, 2024

I mentioned on #100 that I can with upstreaming my changes, I don't have the time right now, but I can give a brief summary of what I did for the ROCm documentation:

For ROCm documentation the style is applied by a the "rocm-docs" sphinx theme hosted here: https://github.com/ROCm/rocm-docs-core. It is in turn based on sphinx-book-theme.

The PR that added the styling you see was ROCm/rocm-docs-core#36.

The source of extra_stylsheet is doxygen_awesome.css scoped to the doxygen-content class similarly of what doxysphinx does dynamically with sass. To avoid the node dependency, which would have been painful for the many ROCm projects, I instead opted to preprocess the style-sheet and distribute it with our theme.

Tangentially, I did not use sass even for prepocessing as I found it to be slightly wrong (It breaks rules that refer to html and body, we do not simply want to add the class in front of these). That's why I made https://github.com/StreamHPC/simple-css-selector-transform. The idea was to integrate this to doxysphinx, but I ended up just pre-processing the sources in the interest of time.

More importantly I replaced references of html.light-mode with html[data-theme=dark] which is how pydata-sphinx-theme switches the theme, so the doxygen-awesome dark-mode is kept in sync with the rest of the site.

The rest is just slightly different choices compared to the demo in doxysphinx, for example I chose to hide the titles from the doxygen html and instead use the sphinx ones, which I think integrates better with the rest of the site.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants