finished moving "style" to "colorTheme, colorThemeSwitcher"

This commit is contained in:
Junyi Hou 2024-03-13 16:59:22 +08:00
parent 80298828e7
commit 4bd6cadc3b
2 changed files with 15 additions and 4 deletions

View File

@ -21,12 +21,18 @@
{{ partial "favicons.html" . }}
{{ $colorTheme := "light-without-switcher" }}
{{ $colorTheme := "light" }}
{{ $colorThemeSwitcher := false }}
{{ if and (isset site.Params "colortheme") (ne site.Params.colortheme "") }}
{{ $colorTheme = site.Params.colortheme | lower }}
{{ end }}
{{ if not (in (slice "light-without-switcher" "dark-without-switcher") $colorTheme) }}
{{ if and (isset site.Params "colorthemeswitcher") }}
{{ $colorThemeSwitcher = site.Params.colorthemeswitcher }}
{{ end }}
{{ if or (eq $colorThemeSwitcher true) (eq $colorTheme "auto") }}
<style>
body {
visibility: hidden;

View File

@ -1,10 +1,15 @@
{{ $colorTheme := "light-without-switcher" }}
{{ $colorTheme := "light" }}
{{ $colorThemeSwitcher := false }}
{{ if and (isset site.Params "colortheme") (ne site.Params.colortheme "") }}
{{ $colorTheme = site.Params.colortheme | lower }}
{{ end }}
{{ if not (in (slice "light-without-switcher" "dark-without-switcher") $colorTheme) }}
{{ if and (isset site.Params "colorthemeswitcher") }}
{{ $colorThemeSwitcher = site.Params.colorthemeswitcher }}
{{ end }}
{{ if or (eq $colorThemeSwitcher true) (eq $colorTheme "auto") }}
{{ if site.Params.colorthemeswitcher }}
<div class="theme-switcher">
{{ partial "font-awesome.html" (dict "iconName" "theme-light" "custom" false) }}