mirror of
https://gitlab.com/skysthelimit.dev/selenite.git
synced 2025-06-15 18:12:08 -05:00
31 lines
1.3 KiB
JavaScript
31 lines
1.3 KiB
JavaScript
var themeloaded = 0;
|
|
$.getJSON("/themes.json", function (data) {
|
|
loadedthemes = data;
|
|
let currenttheme = getCookie("theme");
|
|
if (currenttheme == "") {
|
|
setTheme("selenite", 1);
|
|
} else {
|
|
setTheme(currenttheme, 1);
|
|
}
|
|
});
|
|
|
|
var r = document.querySelector(":root");
|
|
function setTheme(themename, firstload) {
|
|
if (!loadedthemes[themename]) {
|
|
alert("woah, you loaded a non-existant theme! if you found this during normal usage of the website, please send a bug report at https://forms.gle/j75WUn6UhdqsRZgf7");
|
|
return;
|
|
}
|
|
r.style.setProperty("--input-bg-color", loadedthemes[themename]["--input-bg-color"]);
|
|
r.style.setProperty("--main-text-color", loadedthemes[themename]["--main-text-color"]);
|
|
r.style.setProperty("--p-text-color", loadedthemes[themename]["--p-text-color"]);
|
|
r.style.setProperty("--border-color", loadedthemes[themename]["--border-color"]);
|
|
r.style.setProperty("--game-color", loadedthemes[themename]["--game-color"]);
|
|
r.style.setProperty("--bg-1", loadedthemes[themename]["--bg-1"]);
|
|
r.style.setProperty("--bg-2", loadedthemes[themename]["--bg-2"]);
|
|
r.style.setProperty("--invert-logo", loadedthemes[themename]["--invert-logo"]);
|
|
Cookies.set("theme", themename);
|
|
if(firstload == 1) {
|
|
themeloaded = 1;
|
|
console.log("theme loaded");
|
|
}
|
|
} |