diff --git a/_includes/comments/utterances.html b/_includes/comments/utterances.html index 5fa5760..afd7cd3 100644 --- a/_includes/comments/utterances.html +++ b/_includes/comments/utterances.html @@ -14,8 +14,8 @@ const darkTheme = "github-dark"; let initTheme = lightTheme; - if ($("html[mode=dark]").length > 0 - || ($("html[mode]").length == 0 + if ($("html[data-mode=dark]").length > 0 + || ($("html[data-mode]").length == 0 && window.matchMedia("(prefers-color-scheme: dark)").matches)) { initTheme = darkTheme; } diff --git a/_includes/mermaid.html b/_includes/mermaid.html index b8b6665..e8a0cd4 100644 --- a/_includes/mermaid.html +++ b/_includes/mermaid.html @@ -33,8 +33,8 @@ let initTheme = "default"; - if ($("html[mode=dark]").length > 0 - || ($("html[mode]").length == 0 + if ($("html[data-mode=dark]").length > 0 + || ($("html[data-mode]").length == 0 && window.matchMedia("(prefers-color-scheme: dark)").matches ) ) { initTheme = "dark"; } diff --git a/_includes/mode-toggle.html b/_includes/mode-toggle.html index 372b040..63b2538 100644 --- a/_includes/mode-toggle.html +++ b/_includes/mode-toggle.html @@ -5,6 +5,7 @@