Implement proper dark mode (#800)
* Implement proper dark mode Signed-off-by: hossainemruz <hossainemruz@gmail.com> * Fix footer color in light mode Signed-off-by: hossainemruz <hossainemruz@gmail.com> --------- Signed-off-by: hossainemruz <hossainemruz@gmail.com>
This commit is contained in:
parent
6dc9d1d33d
commit
5f0aebcf68
38 changed files with 1136 additions and 353 deletions
|
@ -11,7 +11,17 @@
|
|||
|
||||
<!--================= add analytics if enabled =========================-->
|
||||
{{- partial "analytics.html" . -}}
|
||||
|
||||
<script>
|
||||
theme = localStorage.getItem('darkmode:color-scheme') || 'system';
|
||||
if (theme == 'system') {
|
||||
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
||||
theme = 'dark';
|
||||
} else {
|
||||
theme = 'light';
|
||||
}
|
||||
}
|
||||
document.documentElement.setAttribute('data-theme', theme);
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body class="type-{{ .Page.Type }} kind-{{ .Page.Kind }}" data-spy="scroll" data-target="#TableOfContents" data-offset="80">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue