summaryrefslogtreecommitdiffstats
path: root/apps/frontpage
diff options
context:
space:
mode:
authorivarlovlie <git@ivarlovlie.no>2022-06-05 21:50:26 +0200
committerivarlovlie <git@ivarlovlie.no>2022-06-05 21:50:26 +0200
commit44a95927edb532f8982cf24c03d9fdd129016bd6 (patch)
treecd0efffc182f9429f8ec2bfe9622e6d36446f112 /apps/frontpage
parent54b63daf1b5cefb54a3c616a4fee3ef57a671936 (diff)
downloadgreatoffice-44a95927edb532f8982cf24c03d9fdd129016bd6.tar.xz
greatoffice-44a95927edb532f8982cf24c03d9fdd129016bd6.zip
feat: Implement new theme switcher component and backend
The theme is now shared between the domain returned by base_domain()
Diffstat (limited to 'apps/frontpage')
-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%