forked from f0ck/f0ckv2
23 lines
796 B
JavaScript
23 lines
796 B
JavaScript
(() => {
|
|
const themes = [ 'f0ck', 'p1nk', 'orange', 'amoled' ];
|
|
const acttheme = localStorage.getItem('theme') ?? "f0ck";
|
|
document.documentElement.setAttribute("theme", acttheme);
|
|
if(themecontainer = document.querySelector("#themes")) {
|
|
const sb = document.createElement("select");
|
|
sb.id = "themeselector";
|
|
themes.forEach(o => {
|
|
const option = document.createElement("option");
|
|
option.text = o;
|
|
if(acttheme === o)
|
|
option.selected = true;
|
|
sb.add(option);
|
|
});
|
|
themecontainer.insertAdjacentElement("afterend", sb);
|
|
sb.addEventListener("change", e => {
|
|
const s = e.target.options[e.target.selectedIndex].innerText;
|
|
document.documentElement.setAttribute("theme", s);
|
|
localStorage.setItem("theme", s);
|
|
});
|
|
}
|
|
})();
|