Skip to content

Commit

Permalink
feat: add color customization for hero section title on homepage (#163)
Browse files Browse the repository at this point in the history
支持为首页 hero 部分的标题文字设置颜色,以适应背景图片。

/kind feature

Fixes #147
Fixes #136


```release-note
支持为首页 hero 部分的标题文字设置颜色,以适应背景图片。
```
  • Loading branch information
ruibaby authored Aug 26, 2024
1 parent 0ff535f commit f43a011
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
22 changes: 13 additions & 9 deletions settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ spec:
help: "选择单条时,文章卡片的图片将位于左侧"
- $formkit: select
name: header_widget
id: header_widget
label: 首页顶部模块
value: site_title
options:
Expand All @@ -33,6 +34,7 @@ spec:
- label: 站点标题
value: site_title
- $formkit: select
if: "$get(header_widget).value !== none"
name: header_background_type
id: header_background_type
key: header_background_type
Expand All @@ -44,27 +46,29 @@ spec:
- label: 图片
value: image
- $formkit: text
if: "$get(header_background_type).value === manual"
if: "$get(header_widget).value !== none && $get(header_background_type).value === manual"
name: header_background
id: header_background
key: header_background
label: 首页顶部背景
- $formkit: attachment
if: "$get(header_background_type).value === image"
if: "$get(header_widget).value !== none && $get(header_background_type).value === image"
name: header_background_image
id: header_background_image
key: header_background_image
label: 首页顶部背景图片
value: /themes/theme-earth/assets/images/default-background-2023-10-12.jpeg
- $formkit: radio
- $formkit: color
if: "$get(header_widget).value === site_title"
name: title_color
id: title_color
key: title_color
label: 标题文字颜色
value: #ffffff
- $formkit: checkbox
name: content_header
label: 文章页顶部
label: 显示文章页面顶部背景
value: true
options:
- label: 显示
value: true
- label: 隐藏
value: false

- group: global
label: 全局
Expand Down
8 changes: 6 additions & 2 deletions templates/modules/hero.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@
</th:block>
<th:block th:case="site_title">
<div class="mx-auto flex h-full max-w-7xl flex-col items-center justify-center gap-3 px-4 py-6 lg:px-6">
<span class="text-5xl text-white" th:text="${site.title}"></span>
<span class="text-sm font-light text-white opacity-50" th:text="${site.subtitle}"></span>
<span class="text-5xl" th:style="|color:${theme.config.layout.title_color}|" th:text="${site.title}"></span>
<span
class="text-sm font-light opacity-50"
th:style="|color:${theme.config.layout.title_color}|"
th:text="${site.subtitle}"
></span>
</div>
</th:block>
</th:block>
Expand Down

0 comments on commit f43a011

Please sign in to comment.