mirror of
https://github.com/Wonderfall/hugo-WonderMod.git
synced 2024-11-22 10:31:39 +01:00
automatic theme based on browser theme
usage: add to config params: defaultTheme: "auto"
This commit is contained in:
parent
3081579764
commit
2eef3fcc12
@ -1,3 +1,10 @@
|
|||||||
|
{{ if eq .Site.Params.defaultTheme "auto" }}
|
||||||
|
<script>
|
||||||
|
if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
||||||
|
document.body.classList.add('dark');
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
{{ end }}
|
||||||
<header class="header">
|
<header class="header">
|
||||||
<nav class="nav">
|
<nav class="nav">
|
||||||
{{- if .IsHome }}
|
{{- if .IsHome }}
|
||||||
|
Loading…
Reference in New Issue
Block a user