mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 14:56:19 -04:00
Fix selected theme not loading when refreshing
This commit is contained in:
parent
d3357d2acd
commit
49d69a293b
1 changed files with 6 additions and 2 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue