Fix map display and auto theme detection

- Add missing #map CSS styles to fix map container display
- Fix auto theme detection by implementing proper system preference detection
- Update applyTheme function in all JS files to handle 'auto' theme correctly
- System theme changes are now properly detected and applied when in auto mode
This commit is contained in:
Deco Vander 2025-07-04 16:36:41 -04:00
parent e1be90011e
commit c5356b611a
3 changed files with 21 additions and 3 deletions

View file

@ -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) {

View file

@ -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) {

View file

@ -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) {