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.
|
* Applies the user's preferred color scheme using the `prefers-color-scheme` media query.
|
||||||
*/
|
*/
|
||||||
applyPreferredColorScheme() {
|
applyPreferredColorScheme() {
|
||||||
const prefersDarkScheme = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
const themeFromStorage = this.app?.options?.theme;
|
||||||
const theme = prefersDarkScheme ? "dark" : "classic";
|
let theme = themeFromStorage;
|
||||||
|
if (!theme) {
|
||||||
|
const preferredTheme = (window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "classic");
|
||||||
|
theme = preferredTheme;
|
||||||
|
}
|
||||||
this.changeTheme(theme);
|
this.changeTheme(theme);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user