fix it for real
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
const themeIcon = document.getElementById('theme-icon');
|
||||
|
||||
function getStoredTheme() {
|
||||
return localStorage.getItem('picoPreferredColorScheme') || document.documentElement.getAttribute('data-theme') || 'auto';
|
||||
return localStorage.getItem('picoPreferredColorScheme') || 'auto';
|
||||
}
|
||||
|
||||
function storeTheme(theme) {
|
||||
@@ -45,6 +45,11 @@
|
||||
function init() {
|
||||
if (themeToggle) {
|
||||
|
||||
let storedTheme = getStoredTheme();
|
||||
if (storedTheme && storedTheme !== 'auto') {
|
||||
applyTheme(storedTheme);
|
||||
}
|
||||
|
||||
themeToggle.addEventListener('click', toggleTheme);
|
||||
|
||||
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {
|
||||
|
||||
Reference in New Issue
Block a user