fix: system theme selection immediately applies OS preference instead of reverting to light
This commit is contained in:
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user