Skip to content

Commit

Permalink
Mermaid: stick to default when not dark mode (google#1965)
Browse files Browse the repository at this point in the history
  • Loading branch information
chalin authored Apr 30, 2024
1 parent fbf4256 commit a6d0a70
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions layouts/partials/scripts/mermaid.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@

var settings = norm(mermaid.mermaidAPI.defaultConfig, params);
settings.startOnLoad = true;
const isDark = $('html[data-bs-theme="dark"]').length;
settings.theme = isDark ? 'dark' : 'base';
if ($('html[data-bs-theme="dark"]').length) {
settings.theme = 'dark';
}
mermaid.initialize(settings);

// Handle light/dark mode theme changes
Expand Down

0 comments on commit a6d0a70

Please sign in to comment.