mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-27 10:16:15 -04:00
Merge branch 'master' into master
This commit is contained in:
commit
9ca0152aac
14 changed files with 780 additions and 4 deletions
|
@ -160,7 +160,15 @@ class OptionsWaiter {
|
|||
|
||||
// Update theme selection
|
||||
const themeSelect = document.getElementById("theme");
|
||||
themeSelect.selectedIndex = themeSelect.querySelector(`option[value="${theme}"`).index;
|
||||
let themeOption = themeSelect.querySelector(`option[value="${theme}"]`);
|
||||
|
||||
if (!themeOption) {
|
||||
const preferredColorScheme = this.getPreferredColorScheme();
|
||||
document.querySelector(":root").className = preferredColorScheme;
|
||||
themeOption = themeSelect.querySelector(`option[value="${preferredColorScheme}"]`);
|
||||
}
|
||||
|
||||
themeSelect.selectedIndex = themeOption.index;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -176,6 +184,14 @@ class OptionsWaiter {
|
|||
this.changeTheme(theme);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the user's preferred color scheme using the `prefers-color-scheme` media query.
|
||||
*/
|
||||
getPreferredColorScheme() {
|
||||
const prefersDarkScheme = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
||||
return prefersDarkScheme ? "dark" : "classic";
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the console logging level.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue