mirror of
https://github.com/welpo/tabi.git
synced 2025-10-11 07:46:15 +02:00
fix initial theme lookup
This commit is contained in:
parent
8fd983bc42
commit
8c889a862c
1 changed files with 7 additions and 2 deletions
|
@ -16,8 +16,13 @@ function updateFaviconColor(dark) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the current theme at startup, defaulting to light
|
// Determine the initial theme.
|
||||||
const currentTheme = document.documentElement.getAttribute('data-theme') || 'light';
|
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
|
// Set the favicon color on startup
|
||||||
updateFaviconColor(currentTheme === 'dark');
|
updateFaviconColor(currentTheme === 'dark');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue