diff --git a/public/admin.js b/public/admin.js index a616e0d..3c30a29 100644 --- a/public/admin.js +++ b/public/admin.js @@ -705,7 +705,13 @@ function initializeTheme() { } function applyTheme(theme) { - document.documentElement.setAttribute('data-theme', theme); + if (theme === 'auto') { + // Detect system preference and apply appropriate theme + const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches; + document.documentElement.setAttribute('data-theme', prefersDark ? 'dark' : 'light'); + } else { + document.documentElement.setAttribute('data-theme', theme); + } } function updateThemeIcon(theme, iconElement) { diff --git a/public/app-mapbox.js b/public/app-mapbox.js index 55d74d6..bea752e 100644 --- a/public/app-mapbox.js +++ b/public/app-mapbox.js @@ -617,7 +617,13 @@ function initializeTheme() { } function applyTheme(theme) { - document.documentElement.setAttribute('data-theme', theme); + if (theme === 'auto') { + // Detect system preference and apply appropriate theme + const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches; + document.documentElement.setAttribute('data-theme', prefersDark ? 'dark' : 'light'); + } else { + document.documentElement.setAttribute('data-theme', theme); + } } function updateThemeIcon(theme, iconElement) { diff --git a/public/privacy.html b/public/privacy.html index 6b56e18..b9397b1 100644 --- a/public/privacy.html +++ b/public/privacy.html @@ -165,7 +165,13 @@ } function applyTheme(theme) { - document.documentElement.setAttribute('data-theme', theme); + if (theme === 'auto') { + // Detect system preference and apply appropriate theme + const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches; + document.documentElement.setAttribute('data-theme', prefersDark ? 'dark' : 'light'); + } else { + document.documentElement.setAttribute('data-theme', theme); + } } function updateThemeIcon(theme, iconElement) {