diff --git a/app/core/src/main/resources/static/js/darkmode.js b/app/core/src/main/resources/static/js/darkmode.js index 0cfd37d37..abfe737c9 100644 --- a/app/core/src/main/resources/static/js/darkmode.js +++ b/app/core/src/main/resources/static/js/darkmode.js @@ -45,25 +45,6 @@ function setMode(mode) { tables.forEach((table) => { table.classList.add("table-dark"); }); - - // Handle dynamically created accordion elements - var accordionItems = document.querySelectorAll(".accordion-item"); - accordionItems.forEach((item) => { - item.style.color = "var(--md-sys-color-on-surface)"; - item.style.backgroundColor = "var(--md-sys-color-surface-5)"; - item.style.border = "1px solid var(--md-sys-color-outline-variant)"; - }); - var accordionButtons = document.querySelectorAll(".accordion-button"); - accordionButtons.forEach((button) => { - button.style.color = "var(--md-sys-color-on-surface)"; - button.style.backgroundColor = "var(--md-sys-color-surface-5)"; - button.style.borderColor = "var(--md-sys-color-outline-variant)"; - }); - var accordionBodies = document.querySelectorAll(".accordion-body"); - accordionBodies.forEach((body) => { - body.style.color = "var(--md-sys-color-on-surface)"; - body.style.backgroundColor = "var(--md-sys-color-surface-5)"; - }); } else if (mode === "off") { if (elements && elements.darkModeIcon) { elements.darkModeIcon.textContent = "light_mode"; diff --git a/app/core/src/main/resources/static/js/githubVersion.js b/app/core/src/main/resources/static/js/githubVersion.js index 20a89ace9..ffc22ed08 100644 --- a/app/core/src/main/resources/static/js/githubVersion.js +++ b/app/core/src/main/resources/static/js/githubVersion.js @@ -320,8 +320,9 @@ async function showUpdateModal() { // Update modal with full information const modalBody = document.getElementById('updateModalBody'); if (fullUpdateInfo && fullUpdateInfo.new_versions) { - // Check if dark mode is active - const isDarkMode = localStorage.getItem("dark-mode") === "on"; + const storedMode = localStorage.getItem("dark-mode"); + const isDarkMode = storedMode === "on" || + (storedMode === null && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches); const darkClasses = isDarkMode ? { accordionItem: 'bg-dark border-secondary text-light', accordionButton: 'bg-dark text-light border-secondary', @@ -337,9 +338,10 @@ async function showUpdateModal() {