fix initial theme lookup

This commit is contained in:
Cameron Taylor 2025-04-05 18:24:29 -07:00
parent 8fd983bc42
commit 8c889a862c

View file

@ -16,8 +16,13 @@ function updateFaviconColor(dark) {
}
}
// Get the current theme at startup, defaulting to light
const currentTheme = document.documentElement.getAttribute('data-theme') || 'light';
// Determine the initial theme.
let currentTheme =
localStorage.getItem('theme') ||
document.documentElement.getAttribute('data-theme') ||
window.matchMedia('(prefers-color-scheme: dark)').matches
? 'dark'
: 'light';
// Set the favicon color on startup
updateFaviconColor(currentTheme === 'dark');