Fix selected theme not loading when refreshing
This commit is contained in:
parent
d3357d2acd
commit
49d69a293b
@ -167,8 +167,12 @@ class OptionsWaiter {
|
||||
* Applies the user's preferred color scheme using the `prefers-color-scheme` media query.
|
||||
*/
|
||||
applyPreferredColorScheme() {
|
||||
const prefersDarkScheme = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
||||
const theme = prefersDarkScheme ? "dark" : "classic";
|
||||
const themeFromStorage = this.app?.options?.theme;
|
||||
let theme = themeFromStorage;
|
||||
if (!theme) {
|
||||
const preferredTheme = (window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "classic");
|
||||
theme = preferredTheme;
|
||||
}
|
||||
this.changeTheme(theme);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user