Skip to content

Commit

Permalink
feat: support override system preferences for dark mode
Browse files Browse the repository at this point in the history
Fixed #201
  • Loading branch information
reuixiy committed Jun 24, 2020
1 parent 10fce2b commit 29bd11e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions config-examples/en/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,10 @@ uglyURLs = false
# may still read your blog in
# light mode, even if you have
# hidden the theme toggle.
# Unless you enable the following
# option.

overrideSystemPreferences = false


######################################
Expand Down
3 changes: 3 additions & 0 deletions config-examples/zh-cn/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,9 @@ uglyURLs = false
# 话。类似,如果你开启深色模式并将默认
# 模式修改为它,即使你隐藏开关,你的读
# 者依然可能以浅色模式模式阅读你的博客。
# 除非,你开启下方这个选项。

overrideSystemPreferences = false


######################################
Expand Down
2 changes: 1 addition & 1 deletion layouts/_default/baseof.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="{{ .Site.LanguageCode }}">
<html lang="{{ .Site.LanguageCode }}"{{ if and .Site.Params.enableDarkMode .Site.Params.overrideSystemPreferences }}{{ with .Site.Params.defaultTheme | default "light" }} data-theme="{{ . }}"{{ end }}{{ end }}>
{{ partial "head.html" . }}
<body>
<div class="container">
Expand Down

0 comments on commit 29bd11e

Please sign in to comment.