fix: system theme selection immediately applies OS preference instead of reverting to light

This commit is contained in:
Ulas Kalayci
2026-04-20 10:20:18 +02:00
parent e92487f464
commit ca3da0eccd
4 changed files with 10 additions and 4 deletions
+2 -1
View File
@@ -854,7 +854,8 @@ function applyTheme(value) {
if (value === 'light' || value === 'dark') {
document.documentElement.setAttribute('data-theme', value);
} else {
document.documentElement.removeAttribute('data-theme');
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
document.documentElement.setAttribute('data-theme', prefersDark ? 'dark' : 'light');
}
}