16 lines
559 B
JavaScript
16 lines
559 B
JavaScript
document.addEventListener("DOMContentLoaded", () => {
|
|
const commandBar = document.querySelector("command-bar");
|
|
|
|
commandBar.addEventListener("setOption", event => {
|
|
console.log("SetOption", event);
|
|
switch (event.option) {
|
|
case "bg":
|
|
case "background":
|
|
const value = event.newValue;
|
|
if (value === "dark" || value === "light") {
|
|
document.querySelector(":root").setAttribute("color-scheme", value);
|
|
}
|
|
break;
|
|
}
|
|
});
|
|
});
|