pydata / pydata-sphinx-theme

A clean, three-column Sphinx theme with Bootstrap for the PyData community
https://pydata-sphinx-theme.readthedocs.io
BSD 3-Clause "New" or "Revised" License
601 stars 314 forks source link

Setting default_mode to dark does not work because it is overwritten by the inline script #1661

Closed char101 closed 8 months ago

char101 commented 8 months ago

Hi,

In

https://github.com/pydata/pydata-sphinx-theme/blob/a135c205ef95524760b278482affe0ce4a6302df/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/layout.html#L17

I think light should be {{ default_mode }}, because it adds data-theme="light" attribute to the html tag which overrides the data-mode="dark" attribute.

In my case, I added html_context = {"default_mode": "dark"} to conf.py. In the static source, data-mode="dark" is added to the html tag, but the theme is still light. In the developer tools, a new data-theme="light" is added to the html tag where the cause is above inline script.

12rambau commented 8 months ago

nice catch, would you be willing to make a PR ?

char101 commented 8 months ago

Created a pull request via the web editor

https://github.com/pydata/pydata-sphinx-theme/pull/1663