diff --git a/templates/base.html b/templates/base.html index d82fecb..51be076 100644 --- a/templates/base.html +++ b/templates/base.html @@ -7,8 +7,9 @@ - - + + + @@ -863,6 +864,22 @@ // Update button text for both desktop and mobile updateThemeButtonText(newTheme); + + // Switch highlight.js theme + updateHighlightTheme(newTheme); + } + + function updateHighlightTheme(theme) { + const lightTheme = document.getElementById('highlight-theme-light'); + const darkTheme = document.getElementById('highlight-theme-dark'); + + if (theme === 'dark') { + lightTheme.disabled = true; + darkTheme.disabled = false; + } else { + lightTheme.disabled = false; + darkTheme.disabled = true; + } } function updateThemeButtonText(theme) { @@ -883,6 +900,7 @@ const savedTheme = localStorage.getItem('theme') || 'light'; document.documentElement.setAttribute('data-theme', savedTheme); updateThemeButtonText(savedTheme); + updateHighlightTheme(savedTheme); } // Apply theme immediately (before DOMContentLoaded to prevent flash)