aboutsummaryrefslogtreecommitdiff
path: root/public/js/schemeSwap.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/js/schemeSwap.js')
-rw-r--r--public/js/schemeSwap.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/public/js/schemeSwap.js b/public/js/schemeSwap.js
index de5a6b2..e048f6a 100644
--- a/public/js/schemeSwap.js
+++ b/public/js/schemeSwap.js
@@ -51,3 +51,20 @@ function swapScheme(scheme) {
document.getElementById("css-colorscheme").href = `/css/colorschemes/${scheme}.css`;
console.log(`Set colorscheme to ${getCookie("colorscheme")}`)
}
+
+function setSchemeSelector() {
+ if (!cookieExists("colorscheme")) {
+ setCookie("colorscheme", "catppuccin-macchiato", 90);
+ } else {
+ const scheme = getCookie("colorscheme");
+ const schemeselector = document.getElementById("scheme-selector");
+ if (scheme && schemeselector) {
+ for (let option of schemeselector.options) {
+ if (option.value == scheme) {
+ option.selected = true;
+ break;
+ }
+ }
+ }
+ }
+}