Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ add defaultThemeColor option #849

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions config/_default/params.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ colorScheme = "congo"
defaultAppearance = "light" # valid options: light or dark
autoSwitchAppearance = true

defaultThemeColor = "#FFFFFF"

enableSearch = false
enableCodeCopy = false
enableImageLazyLoading = true
Expand Down
1 change: 1 addition & 0 deletions exampleSite/content/docs/configuration/index.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ Congoはテーマの機能を制御する多数の設定パラメーターを提
|Name|Default|Description|
|---|---|---|
|`colorScheme`|`"congo"`|使用する配色。有効な値は `congo` (デフォルト), `avocado`, `cherry`, `fire`, `ocean`, `sapphire`, `slate` です。詳しくは [カラースキーム]({{< ref "getting-started#カラースキーム" >}})セクションを参照してください。|
|`defaultThemeColor`|`"#FFFFFF"`|まだ翻訳されていません。|
|`defaultAppearance`|`"light"`|デフォルトのテーマ外観、 `light` または `dark` のいずれか。|
|`autoSwitchAppearance`|`true`|テーマの外観を訪問者のオペレーティングシステムの設定に基づいて自動的に切り替えるかどうか。常に `defaultAppearance` を使うようにするには `false` を設定します。|
|`enableSearch`|`false`|サイト内検索を有効にするかどうか。検索機能を有効にするには `true` を設定します。検索機能は、[サイト設定](#サイト設定)の `outputs.home` が正しく設定されているかどうかに依存することに注意してください。|
Expand Down
1 change: 1 addition & 0 deletions exampleSite/content/docs/configuration/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ Many of the article defaults here can be overridden on a per article basis by sp
|Name|Default|Description|
|---|---|---|
|`colorScheme`|`"congo"`|The theme colour scheme to use. Valid values are `congo` (default), `avocado`, `cherry`, `fire`, `ocean`, `sapphire` and `slate`. Refer to the [Colour Schemes]({{< ref "getting-started#colour-schemes" >}}) section for more details.|
|`defaultThemeColor`|`"#FFFFFF"`|The original value (before any scripts modify it) to use for the `theme-color` meta tag. The meta tag will be changed based on the theme (`light` or `dark`) but it is useful for services that source the original value this tag to display an accent color (e.g. Discord)|
|`defaultAppearance`|`"light"`|The default theme appearance, either `light` or `dark`.|
|`autoSwitchAppearance`|`true`|Whether the theme appearance automatically switches based upon the visitor's operating system preference. Set to `false` to force the site to always use the `defaultAppearance`.|
|`enableSearch`|`false`|Whether site search is enabled. Set to `true` to enable search functionality. Note that the search feature depends on the `outputs.home` setting in the [site configuration](#site-configuration) being set correctly.|
Expand Down
1 change: 1 addition & 0 deletions exampleSite/content/docs/configuration/index.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ Congo 提供了大量的配置参数,用于控制主题的功能。下表概
|名称|默认值|描述|
|---|---|---|
|`colorScheme`|`"congo"`|要使用的主题颜色方案。有效值为 `congo`(默认)、`avocado`、`cherry`、`fire`、`ocean`、`sapphire` 和 `slate`。有关详细信息,请参阅[颜色方案]({{< ref "getting-started#颜色方案" >}})部分。|
|`defaultThemeColor`|`"#FFFFFF`|`theme-color` meta 标签的原值(在脚本修改它之前)。meta 标签会根据所选主题而变化(`light` 或 `dark`),但是一些软件(例如 Discord)会使用该标签的原值来显示主题色。|
|`defaultAppearance`|`"light"`|默认的主题外观,可以是 `light` 或 `dark`。|
|`autoSwitchAppearance`|`true`|主题外观是否根据访问者的操作系统首选项自动切换。设置为 `false` 以始终使用 `defaultAppearance`。|
|`enableSearch`|`false`|是否启用站内搜索。设置为 `true` 以启用搜索功能。请注意,搜索功能取决于 [站点配置](#site-configuration) 中的 `outputs.home` 设置正确。|
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/head.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="theme-color" content="rgb(255,255,255)" />
<meta name="theme-color" content="{{ .Site.Params.defaultThemeColor | default "#ffffff" }}" />
{{/* Title */}}
{{ if .IsHome -}}
<title>{{ .Site.Title | emojify }}</title>
Expand Down
Loading