Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/wangchucheng/hugo-eureka.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWang Chucheng <me@wangchucheng.com>2021-07-08 12:00:45 +0300
committerWang Chucheng <me@wangchucheng.com>2021-07-08 12:00:45 +0300
commit9ffd36e6e03aeafec3a3c0778da0b7bb5b030b73 (patch)
treebbc3ee5ac20ffcd24582d7436c1265c5ee92bfa2 /layouts
parentccd5695125f1516db25424dc723eaa9fc6b3e87a (diff)
fix: inconsistent utterances color scheme
Closes #122
Diffstat (limited to 'layouts')
-rw-r--r--layouts/partials/comment/utterances.html12
1 files changed, 9 insertions, 3 deletions
diff --git a/layouts/partials/comment/utterances.html b/layouts/partials/comment/utterances.html
index e2f0471..56e632c 100644
--- a/layouts/partials/comment/utterances.html
+++ b/layouts/partials/comment/utterances.html
@@ -17,15 +17,21 @@
</script>
<script>
{{- if eq .Site.Params.colorScheme "light" }}
- if ((storageColorScheme == 'Auto' && window.matchMedia("(prefers-color-scheme: dark)").matches) || storageColorScheme == "Dark") {
+ if (storageColorScheme == "Auto") {
+ document.getElementById('utterances').setAttribute('theme', 'preferred-color-scheme')
+ } else if (storageColorScheme == "Dark") {
document.getElementById('utterances').setAttribute('theme', 'github-dark')
}
{{- else if eq .Site.Params.colorScheme "dark" }}
- if ((storageColorScheme == 'Auto' && window.matchMedia("(prefers-color-scheme: light)").matches) || storageColorScheme == "Light") {
+ if (storageColorScheme == "Auto") {
+ document.getElementById('utterances').setAttribute('theme', 'preferred-color-scheme')
+ } else if (storageColorScheme == "Light") {
document.getElementById('utterances').setAttribute('theme', 'github-light')
}
{{- else }}
- if (((storageColorScheme == 'Auto' || storageColorScheme == null) && window.matchMedia("(prefers-color-scheme: dark)").matches) || storageColorScheme == "Dark") {
+ if (storageColorScheme == "Light") {
+ document.getElementById('utterances').setAttribute('theme', 'github-light')
+ } else if (storageColorScheme == "Dark") {
document.getElementById('utterances').setAttribute('theme', 'github-dark')
}
{{- end }}