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

DOC: Change color of sample plots for dark mode #51860

Closed
datapythonista opened this issue Mar 9, 2023 · 7 comments · Fixed by #52097
Closed

DOC: Change color of sample plots for dark mode #51860

datapythonista opened this issue Mar 9, 2023 · 7 comments · Fixed by #52097

Comments

@datapythonista
Copy link
Member

xref #50936

There are some sample plots in our getting started docs that don't show properly when the dark theme of our site is enabled:

Screenshot_20230309_123509

We should change the colors so it displays correctly in both the light and dark themes. I assume the image is a svg and the best approach is to simply change the colors in it. But maybe it's autogenerated from pandas somehow, and it's better to change at the generation. @stijnvanhoey thoughts on the best approach?

@NumanIjaz
Copy link
Contributor

take

@stijnvanhoey
Copy link
Contributor

I assume the image is a svg

The images are indeed svg. I would indeed just adjust the figures so they work for both dark/light mode

@Prashantkhobragade
Copy link

If the sample plot does not work well with the dark theme, you can try using a different plotting library that is more compatible with dark themes. For example, the seaborn plotting library has several built-in color schemes that work well with dark backgrounds.

@Aryasarkar008
Copy link
Contributor

we can just use the seaborn library for better visualization. I would love to help out on this.

@stijnvanhoey
Copy link
Contributor

stijnvanhoey commented Mar 13, 2023

The illustrations in the getting started section are created in inkscape and stored as svg-images and not created using a plot-library. I do think the easiest way is to update these so they work in both light/dark theme. E.g. also the black arrows in the illustrations are not working in the dark theme. I'm certainly willing to adjust this myself in the coming weeks, but help is certainly.

@datapythonista in case it is hard to make illustrations both work in light and dark theme, is there an option/admonition/code-snippet... to provide two images and switch them together with the dark/light switch?

@datapythonista
Copy link
Member Author

In theory is supported, but I think someone gave it a try and couldn't get it working. I didn't check the details of the theme, but even if it's using html in the markdown, or a custom directive, I guess shouldn't be difficult to implement. But I think it's doable to have a single image working well for both themes.

@stijnvanhoey
Copy link
Contributor

I've checked the pydata-sphinx theme information:

  • If images doe not have a background, the theme will provide one when switching to dark theme
    image
    @datapythonista I think this would suffice?

  • The theme provides a number of css-variables to make sure the theme-switch can be handled. e.g.
    image
    can be switched to
    image
    by using the --pst-color-on-surface and --pst-color-on-background css color variables and this adjusts on the theme-switch
    image

I'll prepare a PR which:

  • double checks the images and make sure the background is applied in dark-mode and not hiding schema-elements
  • adjusts the getting-started theming to make sure the existing css-variables are used in the getting started section (and will make the color more consistent to the rest of the docs)

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

Successfully merging a pull request may close this issue.

5 participants