aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrankie B <git@diskfloppy.me>2024-01-22 01:33:40 +0000
committerFrankie B <git@diskfloppy.me>2024-01-22 01:33:40 +0000
commit6f3be14459d72e2bf666bafcce3675dd1222092c (patch)
tree5efe5c4446396f42261d22184f120b9f8d779dfd
parent2b9db42593d1a1208cfbee05d5b29576af2d6910 (diff)
turns out this code was important
-rw-r--r--public/js/schemeSwap.js17
-rw-r--r--resources/views/layouts/default.blade.php2
2 files changed, 18 insertions, 1 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;
+ }
+ }
+ }
+ }
+}
diff --git a/resources/views/layouts/default.blade.php b/resources/views/layouts/default.blade.php
index 996d895..0945b9c 100644
--- a/resources/views/layouts/default.blade.php
+++ b/resources/views/layouts/default.blade.php
@@ -4,7 +4,7 @@
@include('includes.head')
</head>
-<body>
+<body onload="setSchemeSelector()">
<div class="page">
<div id="header" class="header">
@include('includes.header')