mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-25 01:06:16 -04:00
Improved theme selection. Added changeTheme method.
This commit is contained in:
parent
6659174f88
commit
383aab5f85
2 changed files with 18 additions and 3 deletions
|
@ -153,14 +153,28 @@ class OptionsWaiter {
|
|||
|
||||
|
||||
/**
|
||||
* Changes the theme by setting the class of the <html> element.
|
||||
* Theme change event listener
|
||||
*
|
||||
* @param {Event} e
|
||||
*/
|
||||
themeChange(e) {
|
||||
const themeClass = e.target.value;
|
||||
|
||||
document.querySelector(":root").className = themeClass;
|
||||
this.changeTheme(themeClass);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Changes the theme by setting the class of the <html> element.
|
||||
*
|
||||
* @param (string} theme
|
||||
*/
|
||||
changeTheme(theme) {
|
||||
document.querySelector(":root").className = theme;
|
||||
|
||||
// Update theme selection
|
||||
const themeSelect = document.getElementById("theme");
|
||||
themeSelect.selectedIndex = themeSelect.querySelector(`option[value="${theme}"`).index;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue