mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 15:28:57 +00:00
⚡ Perf: simplify theme switching logic
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
<body data-header-desktop="{{ .Site.Params.header.desktopMode }}" data-header-mobile="{{ .Site.Params.header.mobileMode }}">
|
||||
{{- /* Check theme isDark before body rendering */ -}}
|
||||
{{- $theme := .Site.Params.defaulttheme -}}
|
||||
<script>(window.localStorage && localStorage.getItem('theme') ? localStorage.getItem('theme') === 'dark' : ('{{ $theme }}' === 'auto' ? window.matchMedia('(prefers-color-scheme: dark)').matches : '{{ $theme }}' === 'dark')) && document.body.setAttribute('theme', 'dark');</script>
|
||||
<script>(window.localStorage && localStorage.getItem('theme') ? localStorage.getItem('theme') === 'dark' : ('{{ $theme }}' === 'auto' ? window.matchMedia('(prefers-color-scheme: dark)').matches : '{{ $theme }}' === 'dark')) && document.body.setAttribute('data-theme', 'dark');</script>
|
||||
{{- /* Body wrapper */ -}}
|
||||
<div class="wrapper">
|
||||
{{- partial "header.html" . -}}
|
||||
|
||||
Reference in New Issue
Block a user