From a127d5a3143cff8ca851ff7c48070699393f0182 Mon Sep 17 00:00:00 2001 From: nxxy335 Date: Sun, 27 Sep 2026 15:16:46 +0800 Subject: [PATCH] =?UTF-8?q?feat(v1.2.0):=20=E4=B8=BB=E9=A2=98=E9=85=8D?= =?UTF-8?q?=E8=89=B2=E7=B3=BB=E7=BB=9F=20+=20Hero=20=E6=96=87=E5=AD=97?= =?UTF-8?q?=E6=95=88=E6=9E=9C/=E4=B8=80=E8=A8=80=E9=A2=9C=E8=89=B2?= =?UTF-8?q?=EF=BC=9B=E4=BF=AE=E5=A4=8D=20/douban=20500=E3=80=81=E5=8F=8B?= =?UTF-8?q?=E9=93=BE=E6=82=AC=E6=B5=AE=E5=85=89=E5=9C=88=E8=A3=81=E5=88=87?= =?UTF-8?q?=E3=80=81=E7=9E=AC=E9=97=B4=E9=A1=B6=E5=9B=BE=E9=97=B4=E8=B7=9D?= =?UTF-8?q?=EF=BC=9BHalo=20=E7=89=88=E6=9C=AC=E8=A6=81=E6=B1=82=202.26+?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增官方预设调色板 11 套(浅/深双套色板,玻璃/阴影自动跟随),强调色留空跟随配色 - Hero 一言独立颜色配置(浅/深);文字显示效果:阴影/光晕/半透明遮罩/渐变遮罩/容器;默认无效果,移除自带散光 - /douban 适配 plugin-douban 1.2.6 SQLite 扁平化数据结构(item.spec.* -> item.*) - 友链卡片去掉 overflow:hidden,修复悬浮光圈被裁切;徽章简化为仅显示可达性 - 瞬间页顶图与首条卡片增加间距;theme-color 随配色/明暗联动 --- README.md | 3 +- docs/changelog.md | 26 +++ docs/config/hero.md | 35 ++++ docs/config/style.md | 27 ++- package.json | 2 +- settings.yaml | 60 +++++- src/components/HeroSection.astro | 106 ++++++++-- src/components/ThemeSwitcher.astro | 3 +- src/layouts/Layout.astro | 27 ++- src/pages/douban.astro | 42 ++-- src/pages/links.astro | 16 +- src/pages/moments.astro | 2 + src/styles/_colors.scss | 23 ++- src/styles/_palettes.scss | 320 +++++++++++++++++++++++++++++ src/styles/main.scss | 1 + theme.yaml | 4 +- 16 files changed, 627 insertions(+), 70 deletions(-) create mode 100644 src/styles/_palettes.scss diff --git a/README.md b/README.md index d76eb3a..3c07261 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ ## 环境要求 - Halo **2.26.0 及以上**(页面布局契约、微信读书页面均依赖 2.26 的新能力) +- v1.2.0 起内置主题配色系统(纯 CSS 变量实现);更低版本的 Halo 请使用主题 v1.1.x ## 特点 @@ -30,7 +31,7 @@ | [友情链接](https://halo.run/store/apps/app-hfbQg) | `PluginLinks` | `/links` | 友链展示页面,支持随机排列、随机传送门、评论区开关 | | [朋友圈](https://github.com/halo-sigs/plugin-friends) | `plugin-friends` | `/friends` | RSS 订阅朋友圈页面 | | [装备管理](https://github.com/chengzhongxue/plugin-equipment) | `equipment` | `/equipments` | 装备展示页面,按分组展示,支持封面图 | -| [豆瓣](https://github.com/chengzhongxue/plugin-douban) | `plugin-douban` | `/douban` | 豆瓣记录页面,支持类型/状态/标签筛选,默认电影 | +| [豆瓣](https://github.com/chengzhongxue/plugin-douban) | `plugin-douban` | `/douban` | 豆瓣记录页面,支持类型/状态/标签筛选,默认音乐;需插件 **v1.2.6+**(SQLite 数据结构) | | [Steam 信息展示](https://github.com/Tim0x0/halo-plugin-steam) | `PluginSteam` | `/steam` | Steam 游戏库页面,含用户资料、统计数据、最近游玩、游戏库分页 | | [微信读书](https://github.com/yeora26/halo-weread-plugin) | `halo-weread-plugin` | 自定义页面 | 书架展示页面,见下方「自定义页面模板」 | | [记得](https://github.com/yyliucha/plugin-important-dates) | `plugin-important-dates` | `/important-dates` | 重要日期 / 牵挂的人 / 爱车双视图页面,见下方「扩展页面」 | diff --git a/docs/changelog.md b/docs/changelog.md index a3568b8..5c5042f 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,5 +1,31 @@ # 更新日志 +## v1.2.0 + +### 主题配色系统 + +- ✨ 新增「主题配色」设置(总体样式 → 主题配色),内置 11 套官方预调配色:暖屿·赤陶(默认)、抹茶、黛蓝、樱粉、暮紫、海盐、琥珀、梅酒、石墨、可拿铁、天青 +- 🎨 每套配色包含浅色 / 深色两套完整色板,玻璃拟态、遮罩、阴影色调自动跟随当前配色 +- 🎨 自定义「强调色」改为留空跟随所选配色;填写后仍可单独覆盖 +- 📱 浏览器地址栏 theme-color 随配色与明暗模式联动(含切换按钮) + +### Hero 首屏 + +- ✨ 一言文字新增独立颜色配置(浅色 / 深色模式各一项,此前只能跟随副标题颜色) +- ✨ 新增「文字显示效果」设置:阴影 / 光晕 / 半透明遮罩层 / 渐变遮罩 / 容器(半透明边框圆角矩形 + 加大留白) +- 🐛 默认改为无任何效果:移除标题、副标题与一言自带的白色散光投影 + +### 问题修复 + +- 🐛 修复 /douban 页面 500:适配豆瓣插件 v1.2.6 的 SQLite 数据结构(字段由 `item.spec.*` / `item.faves.*` 扁平化为 `item.*` / `item.faves*`) +- 🐛 修复友情链接卡片悬浮光圈被裁切的问题(卡片容器不再裁切悬浮阴影与上移位移) +- 🐛 修复瞬间页面顶图与最新一条瞬间卡片的边框贴合的问题,顶图下方增加间距 +- 🐛 友情链接卡片徽章简化为仅展示站点可达性(绿点 = 可访问,红点 = 异常),不再联合反链检测结果判断 + +### 其他 + +- ⬆️ Halo 版本要求提升至 **2.26+** + ## v1.1.1 ### 瞬间页面 diff --git a/docs/config/hero.md b/docs/config/hero.md index cb805e1..2928453 100644 --- a/docs/config/hero.md +++ b/docs/config/hero.md @@ -13,7 +13,17 @@ Hero 首屏是 WarmIsland 主题的标志性区域,占据首页首屏的全部 | `hero_hitokoto_api` | URL | `https://v1.hitokoto.cn/` | 一言 API 地址 | | `hero_hitokoto_categories` | 多选 | `d, i, k` | 一言句子类型 | | `hero_custom_description` | 多行文本 | — | 自定义描述文案 | +| `hero_hitokoto_auto_refresh` | 开关 | `false` | 一言自动刷新 | +| `hero_hitokoto_refresh_interval` | 下拉 | `10000` | 一言刷新间隔(秒) | | `hero_background_image` | 附件 | — | 背景图片 | +| `hero_background_image_dark` | 附件 | — | 深色模式背景图片 | +| `hero_title_color_light` | 颜色 | — | 大标题颜色(浅色模式),留空使用主题默认 | +| `hero_title_color_dark` | 颜色 | — | 大标题颜色(深色模式),留空使用主题默认 | +| `hero_subtitle_color_light` | 颜色 | — | 副标题颜色(浅色模式),留空使用主题默认 | +| `hero_subtitle_color_dark` | 颜色 | — | 副标题颜色(深色模式),留空使用主题默认 | +| `hero_quote_color_light` | 颜色 | — | 一言文字颜色(浅色模式),留空使用主题默认 | +| `hero_quote_color_dark` | 颜色 | — | 一言文字颜色(深色模式),留空使用主题默认 | +| `hero_text_effect` | 下拉 | `none` | 文字显示效果:`none` / `shadow` / `glow` / `scrim` / `gradient` / `frame` | ## 详细说明 @@ -102,6 +112,31 @@ hero_custom_description: "用文字记录生活,用代码构建世界。" 背景图片会自动应用模糊和暗化处理,以确保前景文字的可读性。建议选择色彩柔和、不包含大量细节的图片作为背景,避免干扰文案阅读。 ::: +### 文字颜色 + +标题、副标题、一言的颜色均可分别配置浅色 / 深色模式的取值,留空使用主题默认: + +- **`hero_title_color_light` / `hero_title_color_dark`** — 大标题颜色。 +- **`hero_subtitle_color_light` / `hero_subtitle_color_dark`** — 副标题颜色。 +- **`hero_quote_color_light` / `hero_quote_color_dark`** — 一言文字颜色(`hero_description_mode` 为 `hitokoto` 或 `custom` 时生效)。 + +### 文字显示效果(hero_text_effect) + +为 Hero 文字(标题 / 副标题 / 一言)叠加辅助可读效果。**默认 `none` 不使用任何效果**——v1.2.0 起,文字周围默认不再有淡淡的白色散光投影: + +| 值 | 效果 | 说明 | +| --- | --- | --- | +| `none` | 无效果(默认) | 纯净文字,无任何附加投影与衬底 | +| `shadow` | 阴影 | 文字下方叠加柔和的深色投影,适合复杂背景图 | +| `glow` | 光晕 | 文字周围叠加白色光晕,暗色背景图上更醒目 | +| `scrim` | 半透明遮罩层 | 文字背后垫一块毛玻璃圆角衬底,整体提升可读性 | +| `gradient` | 渐变遮罩 | 文字背后垫斜向渐变衬底,左深右浅自然过渡 | +| `frame` | 容器 | 把文字"装"进一个带半透明边框的圆角矩形,加大内边距与字距留白 | + +::: tip +遮罩类(`scrim` / `gradient`)与容器(`frame`)作用于整个文字区块,浅色模式为白色系衬底、深色模式为黑色系衬底;`frame` 会在浅色模式下使用墨色描边、深色模式下使用白色描边。 +::: + ## 视觉效果 Hero 区域包含以下精心设计的视觉效果: diff --git a/docs/config/style.md b/docs/config/style.md index 21af03a..c1e52ea 100644 --- a/docs/config/style.md +++ b/docs/config/style.md @@ -7,7 +7,8 @@ | 配置项 | 类型 | 默认值 | 说明 | | --- | --- | --- | --- | | `color_scheme` | 单选 | `system` | 配色方案:`system` / `light` / `dark` | -| `accent_color` | 颜色 | `#d4764e` | 全局强调色 | +| `color_palette` | 下拉 | `warm-island` | 主题配色(官方预设调色板,含深浅两套色板) | +| `accent_color` | 颜色 | — | 自定义强调色;留空跟随所选主题配色 | | `border_radius` | 下拉 | `medium` | 圆角风格:`small` / `medium` / `large` | | `layout_container_width` | 下拉 | `medium` | 容器宽度:`narrow` / `medium` / `wide` | | `animation_enabled` | 开关 | `true` | 全局动画总开关 | @@ -32,6 +33,28 @@ 选择 `system` 时,主题会监听操作系统的 `prefers-color-scheme` 媒体查询,实时响应用户的系统设置变化。访问者也可以通过导航栏的主题切换按钮手动覆盖当前模式。 ::: +### 主题配色(color_palette) + +v1.2.0 起主题内置配色系统,提供 11 套官方预调配色,每套均包含浅色与深色两套完整色板(背景、文字、分隔线、强调色、玻璃拟态、阴影色调等会整体联动): + +| 值 | 名称 | 色彩倾向 | +| --- | --- | --- | +| `warm-island` | 暖屿 · 赤陶(默认) | 暖橘陶土,米白纸感 | +| `matcha` | 抹茶 | 清新草绿,米绿纸感 | +| `indigo` | 黛蓝 | 沉稳蓝调,冷白纸感 | +| `sakura` | 樱粉 | 柔和粉调,樱白纸感 | +| `violet` | 暮紫 | 温柔紫调,淡紫纸感 | +| `sea` | 海盐 | 青碧蓝绿,浅青纸感 | +| `amber` | 琥珀 | 蜂蜜金黄,暖黄纸感 | +| `plum` | 梅酒 | 酒红梅紫,粉白纸感 | +| `graphite` | 石墨 | 中性灰黑,极简无彩 | +| `cocoa` | 可拿铁 | 咖啡可可,奶咖纸感 | +| `azure` | 天青 | 明快天蓝,浅蓝纸感 | + +::: warning +下方「强调色」留空时,将使用所选配色自带的强调色。**老站点升级前如果保存过强调色(默认 `#d4764e`),切换配色后强调色不会变化——清空强调色并保存即可恢复跟随配色。** +::: + ### 强调色(accent_color) 强调色是 WarmIsland 主题的灵魂,它会影响全站以下元素的颜色: @@ -43,7 +66,7 @@ - 选中状态颜色 - Hero 区域渐变色的组成部分 -默认值 `#d4764e` 是暖屿标志性的暖橘色,与主题的温暖气质相呼应。 +留空时跟随上方「主题配色」自带的强调色(暖屿·赤陶配色即 `#d4764e` 暖橘色)。 ::: tip 选择强调色时,建议同时考虑浅色和深色模式下的可读性。可以在 [CSS 变量](/customize/css-variables) 页面查看所有受影响的变量,进行更精细的调整。 diff --git a/package.json b/package.json index 513fdef..dfa8ccf 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "1.1.12", + "version": "1.2.0", "type": "module", "engines": { "node": ">=22.12.0" diff --git a/settings.yaml b/settings.yaml index 4a45cbe..703ae2f 100644 --- a/settings.yaml +++ b/settings.yaml @@ -99,10 +99,38 @@ spec: - label: 深色 value: dark value: system + - $formkit: select + name: color_palette + label: 主题配色 + options: + - label: 暖屿 · 赤陶(默认) + value: warm-island + - label: 抹茶 + value: matcha + - label: 黛蓝 + value: indigo + - label: 樱粉 + value: sakura + - label: 暮紫 + value: violet + - label: 海盐 + value: sea + - label: 琥珀 + value: amber + - label: 梅酒 + value: plum + - label: 石墨 + value: graphite + - label: 可拿铁 + value: cocoa + - label: 天青 + value: azure + value: warm-island + help: 整套官方预调配色(含深浅两套色板);下方的强调色留空时跟随所选配色,填写后将覆盖配色中的强调色 - $formkit: color name: accent_color label: 强调色 - value: "#d4764e" + help: 自定义强调色;留空使用「主题配色」自带的强调色 - $formkit: select name: border_radius label: 圆角风格 @@ -329,11 +357,37 @@ spec: - $formkit: color name: hero_subtitle_color_light label: 浅色模式副标题颜色 - help: Hero 副标题和一言文字颜色(浅色模式);留空使用主题默认 + help: Hero 副标题文字颜色(浅色模式);留空使用主题默认 - $formkit: color name: hero_subtitle_color_dark label: 深色模式副标题颜色 - help: Hero 副标题和一言文字颜色(深色模式);留空使用主题默认 + help: Hero 副标题文字颜色(深色模式);留空使用主题默认 + - $formkit: color + name: hero_quote_color_light + label: 浅色模式一言颜色 + help: 一言(描述文案来源为"一言"时)的文字颜色(浅色模式);留空使用主题默认 + - $formkit: color + name: hero_quote_color_dark + label: 深色模式一言颜色 + help: 一言的文字颜色(深色模式);留空使用主题默认 + - $formkit: select + name: hero_text_effect + label: 文字显示效果 + options: + - label: 无效果(默认) + value: none + - label: 阴影 + value: shadow + - label: 光晕 + value: glow + - label: 半透明遮罩层 + value: scrim + - label: 渐变遮罩 + value: gradient + - label: 容器(半透明边框圆角矩形) + value: frame + value: none + help: 为 Hero 文字(标题/副标题/一言)叠加的辅助可读效果;默认无效果。遮罩类与容器类会在文字背后垫一层衬底并增加留白 - group: home label: 首页 formSchema: diff --git a/src/components/HeroSection.astro b/src/components/HeroSection.astro index af7e136..0cb70d5 100644 --- a/src/components/HeroSection.astro +++ b/src/components/HeroSection.astro @@ -5,12 +5,14 @@ + +
@@ -313,12 +315,6 @@ letter-spacing: -0.03em; color: var(--hero-title-text, var(--ink)); line-height: var(--leading-tight); - /* 背景图完整显示后,用轻投影保证文字在复杂图片上仍可读 */ - text-shadow: 0 1px 3px rgba(255, 253, 250, 0.6), 0 1px 14px rgba(255, 253, 250, 0.4); - } - - html.dark .hero__title { - text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55), 0 1px 14px rgba(0, 0, 0, 0.35); } .hero__subtitle { @@ -327,25 +323,93 @@ color: var(--hero-subtitle-text, var(--ink-2)); letter-spacing: 0.05em; line-height: var(--leading-normal); - text-shadow: 0 1px 3px rgba(255, 253, 250, 0.6), 0 1px 10px rgba(255, 253, 250, 0.4); - } - - html.dark .hero__subtitle { - text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55), 0 1px 10px rgba(0, 0, 0, 0.35); } .hero__description { font-size: var(--text-lg); - color: var(--ink-2); + color: var(--hero-quote-text, var(--ink-2)); line-height: var(--leading-relaxed); max-width: 560px; text-align: center; transition: opacity 0.3s ease; - text-shadow: 0 1px 3px rgba(255, 253, 250, 0.55); } - html.dark .hero__description { - text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); + /* ===== 文字显示效果(后台「Hero 首屏 → 文字显示效果」,默认 none 无任何附加效果) ===== */ + .hero--fx-shadow .hero__title, + .hero--fx-shadow .hero__subtitle, + .hero--fx-shadow .hero__description { + text-shadow: 0 1px 2px rgba(0, 0, 0, 0.22), 0 2px 10px rgba(0, 0, 0, 0.16); + } + + html.dark .hero--fx-shadow .hero__title, + html.dark .hero--fx-shadow .hero__subtitle, + html.dark .hero--fx-shadow .hero__description { + text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6), 0 2px 12px rgba(0, 0, 0, 0.4); + } + + .hero--fx-glow .hero__title, + .hero--fx-glow .hero__subtitle, + .hero--fx-glow .hero__description { + text-shadow: 0 0 10px rgba(255, 255, 255, 0.85), 0 0 26px rgba(255, 255, 255, 0.5); + } + + html.dark .hero--fx-glow .hero__title, + html.dark .hero--fx-glow .hero__subtitle, + html.dark .hero--fx-glow .hero__description { + text-shadow: 0 0 8px rgba(255, 255, 255, 0.45), 0 0 24px rgba(255, 255, 255, 0.22); + } + + /* 半透明遮罩层:文字背后垫一块毛玻璃衬底 */ + .hero--fx-scrim .hero__content { + background: rgba(255, 255, 255, 0.45); + backdrop-filter: blur(10px); + -webkit-backdrop-filter: blur(10px); + border-radius: 24px; + padding: var(--space-2xl); + } + + html.dark .hero--fx-scrim .hero__content { + background: rgba(0, 0, 0, 0.4); + } + + /* 渐变遮罩:斜向渐变衬底 */ + .hero--fx-gradient .hero__content { + background: linear-gradient( + 135deg, + rgba(255, 255, 255, 0.55) 0%, + rgba(255, 255, 255, 0.18) 100% + ); + border-radius: 24px; + padding: var(--space-2xl); + } + + html.dark .hero--fx-gradient .hero__content { + background: linear-gradient( + 135deg, + rgba(0, 0, 0, 0.5) 0%, + rgba(0, 0, 0, 0.16) 100% + ); + } + + /* 容器:半透明边框圆角矩形 + 更大留白,把文字"装"进设计好的容器里 */ + .hero--fx-frame .hero__content { + border: 1px solid color-mix(in srgb, var(--ink) 22%, transparent); + background: color-mix(in srgb, var(--bg) 30%, transparent); + border-radius: 24px; + padding: var(--space-2xl) var(--space-3xl); + gap: var(--space-xl); + } + + html.dark .hero--fx-frame .hero__content { + border-color: color-mix(in srgb, #ffffff 32%, transparent); + } + + .hero--fx-frame .hero__title { + letter-spacing: 0.08em; + } + + .hero--fx-frame .hero__subtitle { + letter-spacing: 0.22em; } .hero__scroll-indicator { @@ -441,6 +505,16 @@ gap: var(--space-md); } + .hero--fx-scrim .hero__content, + .hero--fx-gradient .hero__content { + padding: var(--space-xl) var(--space-lg); + } + + .hero--fx-frame .hero__content { + padding: var(--space-xl) var(--space-lg); + gap: var(--space-lg); + } + .hero__description { max-width: 90vw; } diff --git a/src/components/ThemeSwitcher.astro b/src/components/ThemeSwitcher.astro index 1f0919a..6ab116e 100644 --- a/src/components/ThemeSwitcher.astro +++ b/src/components/ThemeSwitcher.astro @@ -57,8 +57,9 @@ document.documentElement.classList.toggle("dark", isDark); document.documentElement.setAttribute("data-color-scheme", isDark ? "dark" : "light"); localStorage.setItem("wi-theme", isDark ? "dark" : "light"); + var bgPair = window.WI_PALETTE_BG || { light: "#faf7f2", dark: "#1e1c1a" }; var tc = document.querySelector('meta[name="theme-color"]'); - if (tc) tc.setAttribute("content", isDark ? "#1e1c1a" : "#faf7f2"); + if (tc) tc.setAttribute("content", isDark ? bgPair.dark : bgPair.light); updateIcons(); setTimeout(function() { document.documentElement.classList.remove("wi-theme-transition"); diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index d7f6607..6d0d656 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -24,6 +24,7 @@ const fragmentAttr = layoutFragment ? "html (head, content)" : undefined; class={home ? 'wi-home-snap' : ''} style="overflow-x:hidden" th:classappend="${theme.config?.animation?.animation_enabled == false} ? 'wi-no-animations'" + th:attr="data-palette=${theme.config?.style?.color_palette ?: 'warm-island'}" xmlns:th={layoutFragment ? "https://www.thymeleaf.org" : undefined} th:fragment={fragmentAttr} > @@ -32,7 +33,7 @@ const fragmentAttr = layoutFragment ? "html (head, content)" : undefined; - -
+
-
- +
+
-

+

- + - My: + My:
-
+

diff --git a/src/pages/links.astro b/src/pages/links.astro index b33e064..a55621d 100644 --- a/src/pages/links.astro +++ b/src/pages/links.astro @@ -54,8 +54,7 @@ import Layout from "../layouts/Layout.astro"; rel="noopener noreferrer" class="wi-links__card" th:with="verification=${link.status?.verification}, - accessState=${verification?.access?.state != null ? verification.access.state.name() : null}, - backlinkState=${verification?.backlink != null and verification.backlink.state != null ? verification.backlink.state.name() : null}" + accessState=${verification?.access?.state != null ? verification.access.state.name() : null}" > - +