Switch to CSS media query to avoid unstyled content flash.
This commit is contained in:
parent
642ca15803
commit
f09f5e617a
|
@ -177,9 +177,7 @@ return [
|
|||
let currentTheme = document.documentElement.getAttribute('data-theme');
|
||||
if (currentTheme === 'browser') {
|
||||
currentTheme = (window.matchMedia('(prefers-color-scheme: dark)').matches) ? 'dark' : 'light';
|
||||
document.documentElement.setAttribute('data-theme', currentTheme);
|
||||
}
|
||||
|
||||
App.theme = currentTheme;
|
||||
JS,
|
||||
],
|
||||
|
|
|
@ -12,3 +12,10 @@
|
|||
$theme: 'dark';
|
||||
@import 'common-colors';
|
||||
}
|
||||
|
||||
@media screen and (prefers-color-scheme: dark) {
|
||||
[data-theme="browser"] {
|
||||
$theme: 'dark';
|
||||
@import 'common-colors';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue