summaryrefslogtreecommitdiffstats
path: root/apps/frontpage/src
diff options
context:
space:
mode:
Diffstat (limited to 'apps/frontpage/src')
-rw-r--r--apps/frontpage/src/app.html15
1 files changed, 15 insertions, 0 deletions
diff --git a/apps/frontpage/src/app.html b/apps/frontpage/src/app.html
index 917c2aa..5893110 100644
--- a/apps/frontpage/src/app.html
+++ b/apps/frontpage/src/app.html
@@ -4,6 +4,21 @@
<meta charset="utf-8"/>
<link rel="icon"
href="%sveltekit.assets%/favicon.png"/>
+ <script>
+ const value = `; ${document.cookie}`;
+ const parts = value.split(`; go_theme=`);
+ let currentTheme = "system";
+ if (parts.length === 2) {
+ currentTheme = parts.pop().split(";").shift();
+ }
+ if (currentTheme === "light") {
+ document.querySelector("html").dataset.theme = "light";
+ } else if (currentTheme === "dark") {
+ document.querySelector("html").dataset.theme = "dark";
+ } else {
+ document.querySelector("html").dataset.theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
+ }
+ </script>
<meta name="viewport"
content="width=device-width, initial-scale=1"/>
%sveltekit.head%