plotly / graphing-library-docs

Plotly's graphing libraries documentation.
https://plotly.com/graphing-libraries
Other
54 stars 66 forks source link

Plotly's themes page displays graph templates incorrectly when in dark mode #226

Open Coding-with-Adam opened 1 year ago

Coding-with-Adam commented 1 year ago

This bug was reported by Community Member, Bryan.

If you go to the Theming and Templates page in the docs and switch the docs to dark theme, all the graph examples will show in dark mode.

image

Alexboiboi commented 1 year ago

Hi @Coding-with-Adam , just as a side note. Do you have any any Idea how plotly is achieving this feature in the first place? Since recently, numerous python library documentations introduced dark mode (e.g. PydataTheme), but unlike in the plotly docs, changing the theme does not affect the graphs. Not sure if it is worth posting an issue here though...

nicolaskruchten commented 1 year ago

The dark-mode toggle fires off some simple javascript which crawls the page looking for divs that look like they were produced with Plotly.js and then calls Plotly.react() on those divs to change some basic template parameters: https://github.com/plotly/graphing-library-docs/blob/master/all_static/javascripts/improve.js

It's pretty awkward that this runs on that particular page, and I can imagine we'd want to add a URL-based exclusion to that script or something.