From 6f26cd76a8a43c1cd0bc11277fb71d74f93a9833 Mon Sep 17 00:00:00 2001 From: haotool Date: Tue, 30 Jun 2026 01:56:39 +0800 Subject: [PATCH] =?UTF-8?q?fix(ratewise):=20RW-3=20PWA=20manifest=20?= =?UTF-8?q?=E4=B8=BB=E9=A1=8C=E8=89=B2=20SSOT=20=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - manifest theme_color/background 改讀 STYLE_DEFINITIONS.zen(移除硬編 #8B5CF6/#E8ECF4) - 同步 themes.ts zen primary 99 102 241→124 58 237,修 TS↔index.css 漂移 - 離線模板主題化(需保留 #508 自我修復的高風險合併)列 RW-3b 測試:typecheck、lint、test 2516 passed、build:ratewise、zen 截圖驗證、manifest #7C3AED Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude Co-Authored-By: Happy --- .changeset/rw3-manifest-theme-color-ssot.md | 5 +++++ apps/ratewise/public/manifest.webmanifest | 4 ++-- apps/ratewise/scripts/generate-manifest.mjs | 17 +++++++++++++++-- apps/ratewise/src/config/themes.ts | 2 +- docs/dev/002_development_reward_penalty_log.md | 7 ++++++- 5 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 .changeset/rw3-manifest-theme-color-ssot.md diff --git a/.changeset/rw3-manifest-theme-color-ssot.md b/.changeset/rw3-manifest-theme-color-ssot.md new file mode 100644 index 000000000..c823fb834 --- /dev/null +++ b/.changeset/rw3-manifest-theme-color-ssot.md @@ -0,0 +1,5 @@ +--- +'@app/ratewise': patch +--- + +PWA 安裝/狀態列顏色改用實際主題色(移除硬編 hex),並修正 zen 主色 themes.ts 與 CSS 漂移。 diff --git a/apps/ratewise/public/manifest.webmanifest b/apps/ratewise/public/manifest.webmanifest index 129fdd942..603974dee 100644 --- a/apps/ratewise/public/manifest.webmanifest +++ b/apps/ratewise/public/manifest.webmanifest @@ -2,8 +2,8 @@ "name": "HaoRate 匯率好工具", "short_name": "HaoRate", "description": "HaoRate 匯率好工具顯示臺灣銀行牌告實際買賣價(非中間價),支援 18 種貨幣換算,每 5 分鐘同步,離線可用的 PWA 匯率工具。", - "theme_color": "#8B5CF6", - "background_color": "#E8ECF4", + "theme_color": "#7C3AED", + "background_color": "#F8FAFC", "display": "standalone", "scope": "https://app.haotool.org/ratewise/", "start_url": "https://app.haotool.org/ratewise/", diff --git a/apps/ratewise/scripts/generate-manifest.mjs b/apps/ratewise/scripts/generate-manifest.mjs index 6fe2fe52f..53ef7636a 100644 --- a/apps/ratewise/scripts/generate-manifest.mjs +++ b/apps/ratewise/scripts/generate-manifest.mjs @@ -2,6 +2,19 @@ import { readFileSync, writeFileSync } from 'node:fs'; import { resolve, dirname } from 'node:path'; import { fileURLToPath } from 'node:url'; import { APP_INFO, APP_MANIFEST } from '../src/config/app-info.ts'; +import { STYLE_DEFINITIONS } from '../src/config/themes.ts'; + +// manifest 為靜態單一色,取預設 zen 主題的主色/背景作 SSOT,避免硬編 hex 漂移 +const zenColors = STYLE_DEFINITIONS.zen.colors; + +function rgbTripletToHex(rgbTriplet) { + return `#${rgbTriplet + .trim() + .split(/\s+/) + .map((value) => Number.parseInt(value, 10).toString(16).padStart(2, '0')) + .join('') + .toUpperCase()}`; +} const __dirname = dirname(fileURLToPath(import.meta.url)); const ROOT = resolve(__dirname, '..'); @@ -21,8 +34,8 @@ const manifest = { name: APP_INFO.name, short_name: APP_MANIFEST.shortName, description: `${APP_INFO.name}顯示臺灣銀行牌告實際買賣價(非中間價),支援 ${currencyCount} 種貨幣換算,每 5 分鐘同步,離線可用的 PWA 匯率工具。`, - theme_color: '#8B5CF6', - background_color: '#E8ECF4', + theme_color: rgbTripletToHex(zenColors.primary), + background_color: rgbTripletToHex(zenColors.background), display: 'standalone', // 絕對 HTTPS scope/start_url:避免獨立 PWA partition + Chrome HTTPS-First 在啟動時以 http 語意解析。 // id 維持相對(id 變更會被視為新 PWA 身分,破壞既有安裝更新連續性)。 diff --git a/apps/ratewise/src/config/themes.ts b/apps/ratewise/src/config/themes.ts index 05dfb0f13..2fd30728e 100644 --- a/apps/ratewise/src/config/themes.ts +++ b/apps/ratewise/src/config/themes.ts @@ -119,7 +119,7 @@ const zenStyle: StyleDefinition = { surface: '255 255 255', text: '15 23 42', // slate-900 textMuted: '100 116 139', // slate-500 - primary: '99 102 241', // indigo-500 - 專業紫藍 + primary: '124 58 237', // violet-600(與 index.css 渲染值同步,修 TS↔CSS 漂移) secondary: '71 85 105', // slate-600 accent: '59 130 246', // blue-500 border: '226 232 240', // slate-200 diff --git a/docs/dev/002_development_reward_penalty_log.md b/docs/dev/002_development_reward_penalty_log.md index e5bfa3b81..ea7eadcc8 100644 --- a/docs/dev/002_development_reward_penalty_log.md +++ b/docs/dev/002_development_reward_penalty_log.md @@ -2,7 +2,7 @@ > 版本:outline-v2-ultra > 原則:每筆只保留日期、ID、原因、解法。 -> 本次分數變化:+1(reward 1、penalty 0、neutral 0)|累計總分:+89 +> 本次分數變化:+1(reward 1、penalty 0、neutral 0)|累計總分:+90 ## 新增模板(4 行) @@ -13,6 +13,11 @@ ## 條目(新→舊) +- 日期:2026-06-30 +- ID:reward-rw3-manifest-theme-color-ssot +- 原因:PWA manifest theme_color/background 硬編 #8B5CF6/#E8ECF4,與實際 zen 主題色不符;themes.ts zen primary(99 102 241) 與 index.css(124 58 237) 漂移 +- 解法:manifest 改讀 STYLE_DEFINITIONS.zen 經 rgbTripletToHex 轉換;同步 themes.ts zen primary 至 124 58 237 修漂移(離線模板主題化屬高風險 #508 合併,列 RW-3b) + - 日期:2026-06-30 - ID:reward-rw2-nitro-theme-contrast-fix - 原因:Nitro 深色主題 textMuted 為 slate-500(深底對比過低,次要文字看不清)、primary 為過亮 cyan(按鈕白字對比不足);themes.ts chartLine 與 index.css 漂移