mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-24 00:36:16 -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.
|
||||
*/
|
||||
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…
Add table
Add a link
Reference in a new issue