summaryrefslogtreecommitdiff
path: root/public/index.html
diff options
from:
to:
context:
space:
mode:
authorGravatar SayaAndy <montferrat@tuta.io> 2025-07-23 09:36:44 +0300
committerGravatar SayaAndy <montferrat@tuta.io> 2025-07-23 09:36:44 +0300
commit2920c1f66bb42d7f2acc2972bfffb496d6d73b73 (patch)
tree06e0aa3d5e0c273bf007fec020ff47eb336ab496 /public/index.html
parent6eb434c8aac7f2b35faeba4b96def30d257eaf04 (diff)
downloadweb-0.2.4.tar.gz
web-0.2.4.zip
fix: theme switching & saving0.2.4
Diffstat (limited to 'public/index.html')
-rw-r--r--public/index.html15
1 files changed, 9 insertions, 6 deletions
diff --git a/public/index.html b/public/index.html
index 6559e1e..ba13e3b 100644
--- a/public/index.html
+++ b/public/index.html
@@ -413,10 +413,13 @@
<body data-theme="olive" class="font-spectral text-main-dark overflow-hidden bg-interlocked-hexagons bg-repeat bg-pattern-body h-screen flex">
<script>
- function switchTheme() {
- const currentTheme = document.body.getAttribute('data-theme')
- document.body.setAttribute('data-theme', currentTheme == "olive" ? "lettuce" : "olive");
- localStorage.setItem('theme', currentTheme == "olive" ? "lettuce" : "olive");
+ function switchTheme(theme) {
+ if (theme == "" || typeof theme == "undefined") {
+ const currentTheme = document.body.getAttribute('data-theme');
+ theme = currentTheme == "olive" ? "lettuce" : "olive";
+ }
+ localStorage.setItem('theme', theme);
+ document.body.setAttribute('data-theme', theme);
}
const savedTheme = localStorage.getItem('theme') || 'olive';
@@ -431,7 +434,7 @@
<i class="fas fa-home nav-icon-custom text-sidebar hover:bg-background-dark cursor-pointer transition-colors duration-300 flex justify-center items-center rounded-lg"></i>
<i class="fas fa-search nav-icon-custom text-sidebar hover:bg-background-dark cursor-pointer transition-colors duration-300 flex justify-center items-center rounded-lg"></i>
<i class="fas fa-images nav-icon-custom text-sidebar hover:bg-background-dark cursor-pointer transition-colors duration-300 flex justify-center items-center rounded-lg"></i>
- <i onclick="switchTheme()" class="fas fa-swatchbook nav-icon-custom text-sidebar hover:bg-background-dark cursor-pointer transition-colors duration-300 flex justify-center items-center rounded-lg"></i>
+ <i onclick="switchTheme('')" class="fas fa-swatchbook nav-icon-custom text-sidebar hover:bg-background-dark cursor-pointer transition-colors duration-300 flex justify-center items-center rounded-lg"></i>
</div>
</div>
@@ -488,7 +491,7 @@
<i class="fas fa-home nav-icon-custom text-sidebar hover:bg-background-dark cursor-pointer transition-colors duration-300 flex justify-center items-center rounded-lg"></i>
<i class="fas fa-search nav-icon-custom text-sidebar hover:bg-background-dark cursor-pointer transition-colors duration-300 flex justify-center items-center rounded-lg"></i>
<i class="fas fa-images nav-icon-custom text-sidebar hover:bg-background-dark cursor-pointer transition-colors duration-300 flex justify-center items-center rounded-lg"></i>
- <i onclick="switchTheme()" class="fas fa-swatchbook nav-icon-custom text-sidebar hover:bg-background-dark cursor-pointer transition-colors duration-300 flex justify-center items-center rounded-lg"></i>
+ <i onclick="switchTheme('')" class="fas fa-swatchbook nav-icon-custom text-sidebar hover:bg-background-dark cursor-pointer transition-colors duration-300 flex justify-center items-center rounded-lg"></i>
</div>
<div class="logo-custom text-background-dark font-patua font-extrabold text-center relative grow z-20">
demo.saya.today