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

add css helper for images optimized for both dark and light theme #914

Merged
merged 5 commits into from Sep 7, 2022

Conversation

12rambau
Copy link
Collaborator

@12rambau 12rambau commented Sep 6, 2022

Fix #879

When switching from dark to light theme, image management can become complex. In the current implementation of pydata-sphinx-theme the images that have 0 specifications are added a white background when displayed in dark theme. On the other hand the user can specify a CSS helper class and duplicate its asset to make them look nice in both theme (.only-dark, .only-light).

As discussed in #879, the most common situation is to have images non optimised for dark background but in some cases, the images can work on both. In this PR I'm adding the .dark-light class to setup these image and prevent the addition of the white background.

@12rambau 12rambau marked this pull request as ready for review September 6, 2022 08:49
Copy link
Collaborator

@choldgraf choldgraf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me - I cleaned up the docs a little bit w/ a push to your branch, I hope that's OK! LGTM.

@12rambau 12rambau merged commit d29bfc3 into pydata:main Sep 7, 2022
@12rambau 12rambau deleted the dark-image branch September 7, 2022 09:37
@jarrodmillman jarrodmillman added this to the 0.11 milestone Sep 19, 2022
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.

Document how to remove the automatic white background for images with the dark theme
3 participants