From f43a011527ee50c875fd0f276aa487e382fd936d Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Mon, 26 Aug 2024 14:31:14 +0800 Subject: [PATCH] feat: add color customization for hero section title on homepage (#163) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 支持为首页 hero 部分的标题文字设置颜色,以适应背景图片。 /kind feature Fixes https://github.com/halo-dev/theme-earth/issues/147 Fixes https://github.com/halo-dev/theme-earth/issues/136 ```release-note 支持为首页 hero 部分的标题文字设置颜色,以适应背景图片。 ``` --- settings.yaml | 22 +++++++++++++--------- templates/modules/hero.html | 8 ++++++-- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/settings.yaml b/settings.yaml index fd6c00f..187e825 100644 --- a/settings.yaml +++ b/settings.yaml @@ -21,6 +21,7 @@ spec: help: "选择单条时,文章卡片的图片将位于左侧" - $formkit: select name: header_widget + id: header_widget label: 首页顶部模块 value: site_title options: @@ -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 @@ -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: 全局 diff --git a/templates/modules/hero.html b/templates/modules/hero.html index c0770f1..7f5c295 100644 --- a/templates/modules/hero.html +++ b/templates/modules/hero.html @@ -34,8 +34,12 @@
- - + +