edited post

This commit is contained in:
Morgan 2023-10-29 11:58:42 +09:00
parent 40c6ead3a6
commit 0a08ee920c
3 changed files with 10 additions and 3 deletions

View File

@ -18,7 +18,6 @@
}
.dark {
--theme: #242424;
--entry: rgb(46, 46, 51);
--primary: rgb(218, 218, 219);
--secondary: rgb(155, 156, 157);

View File

@ -70,9 +70,17 @@
if (document.body.className.includes("dark")) {
document.body.classList.remove('dark');
localStorage.setItem("pref-theme", 'light');
{{- if site.Params.label.icon_dark }}
document.body.getElementById('main-logo').src = "{{site.Params.label.icon}}";
{{- end }}
} else {
document.body.classList.add('dark');
localStorage.setItem("pref-theme", 'dark');
{{- if site.Params.label.icon_dark }}
document.body.getElementById('main-logo').src = "{{site.Params.label.icon_dark}}";
{{- end }}
}
})

View File

@ -5,7 +5,7 @@
{{- if site.Title }}
<a href="{{ "" | absLangURL }}" accesskey="h" title="{{ $label_text }}">
{{- if site.Params.label.icon }}
<img src="{{- site.Params.label.icon | absURL -}}" alt="" aria-label="logo"
<img id="main-logo" src="{{- site.Params.label.icon | absURL -}}" alt="" aria-label="logo"
height="{{- site.Params.label.iconHeight | default "24" -}}">
{{- end -}}
{{- else }}
@ -14,7 +14,7 @@
</a>
<div class="logo-switches">
{{- if (not site.Params.disableThemeToggle) }}
<button id="theme-toggle" accesskey="t" title="(Alt + T)">
<button id="theme-toggle" accesskey="t">
<svg id="moon" xmlns="http://www.w3.org/2000/svg" width="24" height="18" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
stroke-linejoin="round">