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

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

Closed
char101 opened this issue Jan 19, 2024 · 2 comments · Fixed by #1663
Closed
Labels
kind: bug Something isn't working

Comments

@char101
Copy link
Contributor

char101 commented Jan 19, 2024

Hi,

In

document.documentElement.dataset.theme = localStorage.getItem("theme") || "light";

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
Copy link
Collaborator

12rambau commented Jan 19, 2024

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

@char101
Copy link
Contributor Author

char101 commented Jan 19, 2024

Created a pull request via the web editor

#1663

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants