Skip to content

fix: Issue with std lib integration schema in darkmode (documentation)#795

Merged
hynek merged 2 commits intohynek:mainfrom
JiwaniZakir:fix/issue-783
Mar 17, 2026
Merged

fix: Issue with std lib integration schema in darkmode (documentation)#795
hynek merged 2 commits intohynek:mainfrom
JiwaniZakir:fix/issue-783

Conversation

@JiwaniZakir
Copy link
Contributor

Fixes #783

Mermaid diagrams in docs/conf.py were always rendered with the neutral theme regardless of the site's dark mode state. The Sphinx Book Theme sets document.documentElement.dataset.theme to 'dark' when dark mode is active, but mermaid_init_js did not inspect this attribute. Updates mermaid_init_js in docs/conf.py to check data-theme === 'dark' and pass the matching Mermaid theme accordingly, falling back to 'neutral' for light mode. Verified by inspecting the rendered HTML attribute set by sphinx-book-theme and confirming the ternary covers both states.

Use only data-theme attribute check instead of also probing
prefers-color-scheme via matchMedia. Split the string across
lines for readability.
@hynek hynek merged commit 0d8c140 into hynek:main Mar 17, 2026
18 checks passed
@hynek
Copy link
Owner

hynek commented Mar 17, 2026

Thanks looks good at least on my phone! 😅

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue with std lib integration schema in darkmode (documentation)

2 participants