Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions js/mermaid-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

(() => {
const darkThemes = ['ayu', 'navy', 'coal'];
const lightThemes = ['light', 'rust'];
const darkThemes = ['navy'];
const lightThemes = ['light'];

const classList = document.getElementsByTagName('html')[0].classList;

Expand All @@ -22,15 +22,19 @@
// Simplest way to make mermaid re-render the diagrams in the new theme is via refreshing the page

for (const darkTheme of darkThemes) {
document.getElementById(darkTheme).addEventListener('click', () => {
const btn = document.getElementById(darkTheme);
if (!btn) continue;
btn.addEventListener('click', () => {
if (lastThemeWasLight) {
window.location.reload();
}
});
}

for (const lightTheme of lightThemes) {
document.getElementById(lightTheme).addEventListener('click', () => {
const btn = document.getElementById(lightTheme);
if (!btn) continue;
btn.addEventListener('click', () => {
if (!lastThemeWasLight) {
window.location.reload();
}
Expand Down