From 0eed773e6dcf999cb052b6f781bfbe7ad74e63c7 Mon Sep 17 00:00:00 2001
From: Aditya Telange <21258296+adityatelange@users.noreply.github.com>
Date: Tue, 3 Nov 2020 20:05:21 +0530
Subject: [PATCH] theme-switch-button: improve logic
- owner can set dark/light/auto default theme
- theme toggle will be enabled on all theme modes unless disbaled
- if disableThemeToggle is true, user won't be able to switch themes,
here auto (a/c to system theme) also works
for #69
---
layouts/partials/footer.html | 2 +-
layouts/partials/header.html | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index f3baf823..dbc49899 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -50,7 +50,7 @@
localStorage.setItem("menu-scroll-position", document.getElementById('menu').scrollLeft);
}
-{{- if (and (not .Site.Params.disableThemeToggle) (not (or (eq .Site.Params.defaultTheme "light") (eq .Site.Params.defaultTheme "dark")))) }}
+{{- if (and (not .Site.Params.disableThemeToggle) (not (eq .Site.Params.defaultTheme "auto"))) }}
{{- end }}
-{{- if (and (.Site.Params.disableThemeToggle) (eq .Site.Params.defaultTheme "auto")) }}
+{{- if (eq .Site.Params.defaultTheme "auto") }}