Skip to content

Commit 48b1f1c

Browse files
committed
Auto merge of #770 - detrumi:mermaid-dark-theme-fix, r=jackh726
Detect dark theme for mermaid diagrams Fixes #761 for the case where you've set your theme beforehand. Changing the theme doesn't change the diagrams until you refresh, I tried adding an event listener to the theme switch but `mermaid.initialize()` doesn't update the diagrams when called twice.
2 parents 4b31070 + 6962efb commit 48b1f1c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

book/mermaid-init.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
mermaid.initialize({startOnLoad:true});
1+
mermaid.initialize({
2+
startOnLoad: true,
3+
theme: ['coal', 'navy', 'ayu'].includes(theme) ? 'dark' : 'default',
4+
});

0 commit comments

Comments
 (0)