Skip to content

Commit

Permalink
fix: inconsistent utterances color scheme
Browse files Browse the repository at this point in the history
Closes #122
  • Loading branch information
wangchucheng committed Jul 8, 2021
1 parent ccd5695 commit 9ffd36e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion data/eureka.yaml
@@ -1 +1 @@
version: 0.8.1
version: 0.8.2-dev
12 changes: 9 additions & 3 deletions layouts/partials/comment/utterances.html
Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "hugo-eureka",
"version": "0.8.1",
"version": "0.8.2-dev",
"description": "Eureka is a feature-rich and highly customizable Hugo theme.",
"repository": "https://github.com/wangchucheng/hugo-eureka",
"author": "C. Wang <me@wangchucheng.com>",
Expand Down

0 comments on commit 9ffd36e

Please sign in to comment.