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:
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?
Comment From: NumanIjaz
take
Comment From: stijnvanhoey
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
Comment From: Prashantkhobragade
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.
Comment From: Aryasarkar008
we can just use the seaborn library for better visualization. I would love to help out on this.
Comment From: stijnvanhoey
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?
Comment From: datapythonista
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.
Comment From: stijnvanhoey
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
@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.
can be switched to
by using the
--pst-color-on-surface
and--pst-color-on-background
css color variables and this adjusts on the theme-switch
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)