From 1b14e023de226e6e218ac078f2db5a4bf4cf2133 Mon Sep 17 00:00:00 2001 From: Cecic <1518585189@qq.com> Date: Mon, 17 Aug 2026 14:00:39 +0800 Subject: [PATCH] feat(theme): ship rainbow_color as default --- .github/workflows/release.yml | 2 +- README.en.md | 2 +- README.md | 2 +- install.ps1 | 5 +- packages/themes/rainbow_color/theme.json | 93 ++++++++++++++++++++++++ scripts/package-release.ps1 | 1 + src/content/sync.mjs | 59 +++++++++------ src/installer/uninstall.mjs | 4 +- src/manage-main.mjs | 4 +- src/theme/validate.mjs | 69 ++++++++++++++++-- test/content-sync.test.mjs | 25 +++++-- test/install-script.test.mjs | 4 +- test/installer/uninstall.test.mjs | 4 +- test/manage-main.test.mjs | 18 ++--- test/theme.test.mjs | 63 ++++++++++++++++ tui/src/main.rs | 17 +++-- 16 files changed, 308 insertions(+), 64 deletions(-) create mode 100644 packages/themes/rainbow_color/theme.json diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6b8eeee..93866d1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -99,7 +99,7 @@ jobs: --repo $env:GITHUB_REPOSITORY ` --verify-tag ` --title "Codex CLI Ultra $tag" ` - --notes "自包含 Windows 安装包:内置已验证的 CCU i18n fork、1396 条简体中文 FTL 和 Hermes 状态栏;新版管理器支持后台任务进度、本地 fork Release 安装与二次确认卸载,并同步显示 CCU、CCU-I18N 和 OpenAI Codex 三路版本。安装器在网络失败时提供直接下载指引。" ` + --notes "自包含 Windows 安装包:内置已验证的 CCU i18n fork、1396 条简体中文 FTL 和 rainbow_color 主题;新版管理器支持后台任务进度、本地 fork Release 安装与二次确认卸载,并同步显示 CCU、CCU-I18N 和 OpenAI Codex 三路版本。安装器在网络失败时提供直接下载指引。" ` --latest } diff --git a/README.en.md b/README.en.md index f21fb89..7aa9948 100644 --- a/README.en.md +++ b/README.en.md @@ -138,7 +138,7 @@ codex-cli-ultra/ ├── docs/ # Design, release contracts, and progress documents ├── packages/ │ ├── languages/zh-CN/ # Simplified Chinese language pack -│ └── themes/ccu-hermes/ # Hermes status-line theme +│ └── themes/ # rainbow_color default and legacy Hermes themes ├── release-channels/ │ └── stable.json # Current stable fork Release metadata ├── research/ # Visible-text catalogs and version research diff --git a/README.md b/README.md index 95304b6..86668e8 100644 --- a/README.md +++ b/README.md @@ -140,7 +140,7 @@ codex-cli-ultra/ ├── docs/ # 设计、发布合同和项目进度文档 ├── packages/ │ ├── languages/zh-CN/ # 简体中文语言包 -│ └── themes/ccu-hermes/ # Hermes 状态栏主题 +│ └── themes/ # rainbow_color 默认主题与 Hermes 旧主题 ├── release-channels/ │ └── stable.json # 当前稳定 fork Release 元数据 ├── research/ # Codex 可见文本目录与版本调查结果 diff --git a/install.ps1 b/install.ps1 index bd90ff9..69deb02 100644 --- a/install.ps1 +++ b/install.ps1 @@ -227,9 +227,9 @@ elseif ($DisableStatusLine) { } elseif (-not $NonInteractive -and [Environment]::UserInteractive -and -not $existingCcuState) { Write-Host '' - Write-Host 'Hermes 彩色状态栏(全新安装默认启用):🦊 gpt-5.6-sol[xhigh] │ 42.7K/353K │ [█░░░░░░░░░] 9% │ ⏱ 1s ⚡0s │' + Write-Host 'Rainbow Color 彩色状态栏(全新安装默认启用):🦊 gpt-5.6-sol[xhigh] │ 42.7K/353K │ [█░░░░░░░░░] 9% │ ⏱ 1s ⚡0s │' while ($true) { - $answer = Read-Host '是否启用 CCU Hermes 四段式状态栏?[Y/n]' + $answer = Read-Host '是否启用 CCU Rainbow Color 四段式状态栏?[Y/n]' if ([string]::IsNullOrWhiteSpace($answer) -or $answer -match '^(?i:y|yes|是)$') { $true break @@ -279,6 +279,7 @@ else { New-Item -ItemType Directory -Path (Join-Path $temporaryContent 'themes') -Force | Out-Null New-Item -ItemType Directory -Path (Join-Path $temporaryContent 'catalog') -Force | Out-Null Copy-Item -LiteralPath (Join-Path $sourceRoot 'packages\languages\zh-CN') -Destination (Join-Path $temporaryContent 'languages\zh-CN') -Recurse + Copy-Item -LiteralPath (Join-Path $sourceRoot 'packages\themes\rainbow_color') -Destination (Join-Path $temporaryContent 'themes\rainbow_color') -Recurse Copy-Item -LiteralPath (Join-Path $sourceRoot 'packages\themes\ccu-hermes') -Destination (Join-Path $temporaryContent 'themes\ccu-hermes') -Recurse Copy-Item -LiteralPath (Join-Path $sourceRoot 'research\codex-0.144.5\tui-messages.jsonl') -Destination (Join-Path $temporaryContent 'catalog\tui-messages.jsonl') Copy-Item -LiteralPath (Join-Path $sourceRoot 'templates\languages\messages.en-US.ftl') -Destination (Join-Path $temporaryContent 'catalog\messages.en-US.ftl') diff --git a/packages/themes/rainbow_color/theme.json b/packages/themes/rainbow_color/theme.json new file mode 100644 index 0000000..efdc98f --- /dev/null +++ b/packages/themes/rainbow_color/theme.json @@ -0,0 +1,93 @@ +{ + "schemaVersion": 1, + "type": "theme", + "id": "rainbow_color", + "displayName": "Rainbow Color", + "version": "1.0.0", + "statusLine": { + "separator": " │ ", + "progressWidth": 10, + "filled": "█", + "empty": "░", + "modelEmojis": [ + "🦊", + "🐱", + "🐶", + "🐼", + "🐨", + "🐰", + "🦁", + "🐯", + "🐸", + "🐵", + "🦄", + "🐙", + "🦋", + "🌟", + "🔥", + "💎", + "🎯", + "🚀", + "⚡", + "🌈" + ], + "palette": [ + "#F5E0DC", + "#F2CDCD", + "#F5C2E7", + "#CBA6F7", + "#FAB387", + "#F9E2AF", + "#A6E3A1", + "#94E2D5", + "#89DCEB", + "#74C7EC", + "#CDD6F4", + "#6C7086" + ], + "randomizePalette": false, + "softenColors": false, + "modelReasoningStyle": "bracketed", + "colors": { + "model": "#F5E0DC", + "usage": "#F5C2E7", + "progress": "#A6E3A1", + "time": "#F9E2AF", + "quota": "#FAB387", + "separator": "#CBA6F7" + } + }, + "welcome": { + "title": "#89DCEB", + "version": "#F5E0DC", + "label": "#89DCEB", + "model": "#F2CDCD", + "path": "#A6E3A1", + "permissions": "#FAB387", + "border": "#89DCEB", + "command": "#89DCEB", + "badge": "#F5C2E7" + }, + "statusCard": { + "border": "#89DCEB", + "title": "#89DCEB", + "version": "#F5E0DC", + "label": "#89DCEB", + "model": "#F2CDCD", + "path": "#A6E3A1", + "permissions": "#FAB387", + "usage": "#89DCEB", + "progress": "#A6E3A1", + "percent": "#74C7EC", + "limits": "#F9E2AF", + "link": "#89DCEB", + "value": "#CDD6F4" + }, + "dialog": { + "selection": "#89DCEB", + "background": null + }, + "composer": { + "background": null + } +} diff --git a/scripts/package-release.ps1 b/scripts/package-release.ps1 index 7cce080..c2bb908 100644 --- a/scripts/package-release.ps1 +++ b/scripts/package-release.ps1 @@ -83,6 +83,7 @@ Copy-Item -LiteralPath (Join-Path $root 'dist\codex-ultra.mjs') -Destination (Jo Copy-Item -LiteralPath (Join-Path $root 'dist\launcher.mjs') -Destination (Join-Path $stage 'bin') Copy-Item -LiteralPath (Join-Path $root 'tui\target\release\ccu-manager.exe') -Destination (Join-Path $stage 'bin') Copy-Item -LiteralPath (Join-Path $root 'packages\languages\zh-CN') -Destination (Join-Path $stage 'content\languages\zh-CN') -Recurse +Copy-Item -LiteralPath (Join-Path $root 'packages\themes\rainbow_color') -Destination (Join-Path $stage 'content\themes\rainbow_color') -Recurse Copy-Item -LiteralPath (Join-Path $root 'packages\themes\ccu-hermes') -Destination (Join-Path $stage 'content\themes\ccu-hermes') -Recurse Copy-Item -LiteralPath (Join-Path $root 'research\codex-0.144.5\tui-messages.jsonl') -Destination (Join-Path $stage 'content\catalog\tui-messages.jsonl') Copy-Item -LiteralPath (Join-Path $root 'templates\languages\messages.en-US.ftl') -Destination (Join-Path $stage 'content\catalog\messages.en-US.ftl') diff --git a/src/content/sync.mjs b/src/content/sync.mjs index b67ac5f..53d069d 100644 --- a/src/content/sync.mjs +++ b/src/content/sync.mjs @@ -17,8 +17,13 @@ import { enableHermesStatusLineConfig } from "./statusline-config.mjs"; +const PRIMARY_THEME_ID = "rainbow_color"; +const PRIMARY_THEME_DIRECTORY = "rainbow_color"; +const HERMES_THEME_ID = "ccu.hermes"; const HERMES_THEME_DIRECTORY = "ccu-hermes"; const LEGACY_THEME_ID = "ccu.deepseek"; +const PREVIOUS_THEME_IDS = new Set([HERMES_THEME_ID, LEGACY_THEME_ID]); +const OWNED_THEME_IDS = new Set([PRIMARY_THEME_ID, HERMES_THEME_ID, LEGACY_THEME_ID]); async function exists(path, lstatImpl = lstat) { try { @@ -104,7 +109,9 @@ async function resolveContentLayout(contentRoot) { language: repoLanguage, catalog: join(contentRoot, "research", "codex-0.144.5", "tui-messages.jsonl"), template: join(contentRoot, "templates", "languages", "messages.en-US.ftl"), - theme: join(contentRoot, "packages", "themes", HERMES_THEME_DIRECTORY), + themes: [PRIMARY_THEME_DIRECTORY, HERMES_THEME_DIRECTORY].map((directory) => + join(contentRoot, "packages", "themes", directory) + ), quota: join(contentRoot, "packages", "quota.example.json") }; } @@ -112,7 +119,9 @@ async function resolveContentLayout(contentRoot) { language: packagedLanguage, catalog: join(contentRoot, "catalog", "tui-messages.jsonl"), template: join(contentRoot, "catalog", "messages.en-US.ftl"), - theme: join(contentRoot, "themes", HERMES_THEME_DIRECTORY), + themes: [PRIMARY_THEME_DIRECTORY, HERMES_THEME_DIRECTORY].map((directory) => + join(contentRoot, "themes", directory) + ), quota: join(contentRoot, "quota.example.json") }; } @@ -122,7 +131,7 @@ async function cacheBundledContent({ installRoot, layout, language, - theme, + themes, fsOps }) { const cacheRoot = join(installRoot, "content"); @@ -134,11 +143,13 @@ async function cacheBundledContent({ join(cacheRoot, "languages", language.locale), fsOps ); - await replaceDirectoryAtomic( - layout.theme, - join(cacheRoot, "themes", basename(layout.theme)), - fsOps - ); + for (const themePath of themes) { + await replaceDirectoryAtomic( + themePath, + join(cacheRoot, "themes", basename(themePath)), + fsOps + ); + } await replaceFileAtomic( layout.catalog, join(cacheRoot, "catalog", "tui-messages.jsonl"), @@ -178,15 +189,19 @@ export async function syncBundledContent(options) { catalogPath: layout.catalog, templatePath: layout.template }); - const theme = validateThemePack( - JSON.parse(await (options.readFile ?? readFile)(join(layout.theme, "theme.json"), "utf8")) - ); + const themes = await Promise.all(layout.themes.map(async (themePath) => + validateThemePack( + JSON.parse(await (options.readFile ?? readFile)(join(themePath, "theme.json"), "utf8")) + ) + )); + const theme = themes.find(({ id }) => id === PRIMARY_THEME_ID); + if (theme === undefined) throw new Error(`missing primary theme: ${PRIMARY_THEME_ID}`); const cachedContentRoot = await cacheBundledContent({ contentRoot, installRoot, layout, language, - theme, + themes: layout.themes, fsOps: options.fsOps }); @@ -195,11 +210,13 @@ export async function syncBundledContent(options) { join(installRoot, "languages", language.locale), options.fsOps ); - await replaceDirectoryAtomic( - layout.theme, - join(installRoot, "themes", theme.id), - options.fsOps - ); + for (let index = 0; index < themes.length; index += 1) { + await replaceDirectoryAtomic( + layout.themes[index], + join(installRoot, "themes", themes[index].id), + options.fsOps + ); + } const makeDirectory = options.fsOps?.mkdir ?? mkdir; const read = options.readFile ?? readFile; @@ -221,11 +238,11 @@ export async function syncBundledContent(options) { const currentTheme = themePreferenceExists ? (await read(themePreference, "utf8")).trim() : null; - if (!themePreferenceExists || currentTheme === LEGACY_THEME_ID) { + if (!themePreferenceExists || PREVIOUS_THEME_IDS.has(currentTheme)) { await write(themePreference, `${theme.id}\n`, "utf8"); } const requestedStatusLinePreset = - options.statusLinePreset === LEGACY_THEME_ID + PREVIOUS_THEME_IDS.has(options.statusLinePreset) ? theme.id : options.statusLinePreset; if ( @@ -245,12 +262,12 @@ export async function syncBundledContent(options) { requestedStatusLinePreset === null && statusLinePreferenceExists ) { - if ([theme.id, LEGACY_THEME_ID].includes(currentStatusLinePreset)) { + if (OWNED_THEME_IDS.has(currentStatusLinePreset)) { await remove(statusLinePreference, { force: true }); } } else if ( requestedStatusLinePreset === undefined && - currentStatusLinePreset === LEGACY_THEME_ID + PREVIOUS_THEME_IDS.has(currentStatusLinePreset) ) { await write(statusLinePreference, `${theme.id}\n`, "utf8"); } diff --git a/src/installer/uninstall.mjs b/src/installer/uninstall.mjs index f41d14f..341536f 100644 --- a/src/installer/uninstall.mjs +++ b/src/installer/uninstall.mjs @@ -65,8 +65,8 @@ export async function uninstallCcu(options = {}) { const removedPreferences = []; for (const [name, expected] of [ ["ui-language", "zh-CN"], - ["ui-theme", ["ccu.hermes", "ccu.deepseek"]], - ["ui-statusline-preset", ["ccu.hermes", "ccu.deepseek"]] + ["ui-theme", ["rainbow_color", "ccu.hermes", "ccu.deepseek"]], + ["ui-statusline-preset", ["rainbow_color", "ccu.hermes", "ccu.deepseek"]] ]) { if ( await removeManagedPreference(join(codexHome, name), expected, options) diff --git a/src/manage-main.mjs b/src/manage-main.mjs index 14d8d54..09b15da 100644 --- a/src/manage-main.mjs +++ b/src/manage-main.mjs @@ -91,7 +91,7 @@ function resolveStatusLinePreset(args) { if (enable && disable) { throw new Error("choose only one of --enable-statusline and --disable-statusline"); } - if (enable) return "ccu.hermes"; + if (enable) return "rainbow_color"; if (disable) return null; return undefined; } @@ -731,7 +731,7 @@ export async function manageMain(options = {}) { const requestedStatusLinePreset = resolveStatusLinePreset(args.slice(1)); const statusLinePreset = requestedStatusLinePreset === undefined && current.installedManifest === null - ? "ccu.hermes" + ? "rainbow_color" : requestedStatusLinePreset; if ( current.installedManifest !== null && diff --git a/src/theme/validate.mjs b/src/theme/validate.mjs index 0fdf4ae..11f0c87 100644 --- a/src/theme/validate.mjs +++ b/src/theme/validate.mjs @@ -42,26 +42,31 @@ function color(value, label) { return value.toLowerCase(); } +function nullableColor(value, label) { + return value === null ? null : color(value, label); +} + export function validateThemePack(value) { assertRecord(value, "theme"); - assertExactKeys( + assertAllowedKeys( value, ["schemaVersion", "type", "id", "displayName", "version", "statusLine", "welcome"], + ["statusCard", "dialog", "composer"], "theme" ); if (value.schemaVersion !== 1 || value.type !== "theme") { throw new Error("unsupported theme schema or type"); } const id = nonempty(value.id, "theme.id"); - if (!/^[a-z0-9]+(?:[.-][a-z0-9]+)*$/.test(id)) { - throw new Error("theme.id must use lowercase dotted or dashed segments"); + if (!/^[a-z0-9]+(?:[._-][a-z0-9]+)*$/.test(id)) { + throw new Error("theme.id must use lowercase dotted, dashed, or underscored segments"); } assertRecord(value.statusLine, "theme.statusLine"); assertAllowedKeys( value.statusLine, ["separator", "progressWidth", "filled", "empty", "colors"], - ["modelReasoningStyle", "modelEmojis", "palette"], + ["modelReasoningStyle", "modelEmojis", "palette", "randomizePalette", "softenColors"], "theme.statusLine" ); if (!Number.isSafeInteger(value.statusLine.progressWidth) || value.statusLine.progressWidth < 4 || value.statusLine.progressWidth > 30) { @@ -94,14 +99,61 @@ export function validateThemePack(value) { ["model", "usage", "progress", "time", "quota", "separator"], "theme.statusLine.colors" ); + const randomizePalette = value.statusLine.randomizePalette ?? true; + const softenColors = value.statusLine.softenColors ?? true; + if (typeof randomizePalette !== "boolean") { + throw new Error("theme.statusLine.randomizePalette must be a boolean"); + } + if (typeof softenColors !== "boolean") { + throw new Error("theme.statusLine.softenColors must be a boolean"); + } assertRecord(value.welcome, "theme.welcome"); - assertExactKeys( + assertAllowedKeys( value.welcome, ["title", "version", "label", "model", "path", "permissions"], + ["border", "command", "badge"], "theme.welcome" ); + let statusCard; + if (value.statusCard !== undefined) { + assertRecord(value.statusCard, "theme.statusCard"); + assertExactKeys( + value.statusCard, + [ + "border", "title", "version", "label", "model", "path", "permissions", + "usage", "progress", "percent", "limits", "link", "value" + ], + "theme.statusCard" + ); + statusCard = Object.fromEntries( + Object.entries(value.statusCard).map(([key, entry]) => [ + key, + color(entry, `theme.statusCard.${key}`) + ]) + ); + } + + let dialog; + if (value.dialog !== undefined) { + assertRecord(value.dialog, "theme.dialog"); + assertExactKeys(value.dialog, ["selection", "background"], "theme.dialog"); + dialog = { + selection: color(value.dialog.selection, "theme.dialog.selection"), + background: nullableColor(value.dialog.background, "theme.dialog.background") + }; + } + + let composer; + if (value.composer !== undefined) { + assertRecord(value.composer, "theme.composer"); + assertExactKeys(value.composer, ["background"], "theme.composer"); + composer = { + background: nullableColor(value.composer.background, "theme.composer.background") + }; + } + return { schemaVersion: 1, type: "theme", @@ -117,6 +169,8 @@ export function validateThemePack(value) { palette: palette.map((value, index) => color(value, `theme.statusLine.palette[${index}]`) ), + randomizePalette, + softenColors, modelReasoningStyle, colors: Object.fromEntries( Object.entries(value.statusLine.colors).map(([key, value]) => [ @@ -130,6 +184,9 @@ export function validateThemePack(value) { key, color(value, `theme.welcome.${key}`) ]) - ) + ), + ...(statusCard === undefined ? {} : { statusCard }), + ...(dialog === undefined ? {} : { dialog }), + ...(composer === undefined ? {} : { composer }) }; } diff --git a/test/content-sync.test.mjs b/test/content-sync.test.mjs index 354e732..928f805 100644 --- a/test/content-sync.test.mjs +++ b/test/content-sync.test.mjs @@ -51,12 +51,21 @@ test("content sync migrates the legacy zh-Hans preference and preserves the them /status-line-item-context-tokens-description = Current tokens used/ ); const theme = JSON.parse( - await readFile(join(installRoot, "themes", "ccu.hermes", "theme.json"), "utf8") + await readFile(join(installRoot, "themes", "rainbow_color", "theme.json"), "utf8") ); assert.equal(theme.statusLine.separator, " │ "); assert.equal(theme.statusLine.modelReasoningStyle, "bracketed"); assert.equal(theme.statusLine.modelEmojis.length, 20); - assert.equal(theme.statusLine.palette.length, 14); + assert.equal(theme.statusLine.palette.length, 12); + assert.equal(theme.statusLine.randomizePalette, false); + assert.equal(theme.statusLine.softenColors, false); + assert.equal(theme.welcome.border, "#89DCEB"); + assert.equal( + JSON.parse( + await readFile(join(installRoot, "themes", "ccu.hermes", "theme.json"), "utf8") + ).id, + "ccu.hermes" + ); const quotaExample = JSON.parse( await readFile(join(installRoot, "quota.example.json"), "utf8") ); @@ -87,13 +96,13 @@ test("content sync migrates the legacy zh-Hans preference and preserves the them const themedResult = await syncBundledContent({ contentRoot: join(installRoot, "content"), installRoot, - statusLinePreset: "ccu.hermes", + statusLinePreset: "rainbow_color", env: { CODEX_HOME: codexHome } }); assert.equal(themedResult.theme.statusLinePresetEnabled, true); assert.equal( await readFile(join(codexHome, "ui-statusline-preset"), "utf8"), - "ccu.hermes\n" + "rainbow_color\n" ); assert.match( await readFile(join(codexHome, "config.toml"), "utf8"), @@ -128,6 +137,8 @@ test("installer guards recursive content replacement with an absolute child-path assert.match(packager, /Release ZIP/); assert.match(source, /messages\.en-US\.ftl/); assert.match(packager, /messages\.en-US\.ftl/); + assert.match(source, /packages\\themes\\rainbow_color/); + assert.match(packager, /packages\\themes\\rainbow_color/); assert.match(source, /fork-release/); assert.match(source, /--enable-statusline/); assert.match(source, /--disable-statusline/); @@ -149,7 +160,7 @@ test("installer guards recursive content replacement with an absolute child-path assert.match(packager, /uninstall\.cmd/); }); -test("content sync migrates the legacy DeepSeek preset and applies Hermes config", async (t) => { +test("content sync migrates the legacy DeepSeek preset and applies rainbow config", async (t) => { const root = await mkdtemp(join(tmpdir(), "ccu-content-legacy-theme-")); t.after(() => rm(root, { recursive: true, force: true })); const codexHome = join(root, "codex-home"); @@ -171,10 +182,10 @@ test("content sync migrates the legacy DeepSeek preset and applies Hermes config installRoot, env: { CODEX_HOME: codexHome } }); - assert.equal(await readFile(join(codexHome, "ui-theme"), "utf8"), "ccu.hermes\n"); + assert.equal(await readFile(join(codexHome, "ui-theme"), "utf8"), "rainbow_color\n"); assert.equal( await readFile(join(codexHome, "ui-statusline-preset"), "utf8"), - "ccu.hermes\n" + "rainbow_color\n" ); assert.equal(result.theme.statusLinePresetEnabled, true); assert.match( diff --git a/test/install-script.test.mjs b/test/install-script.test.mjs index a58f49d..67d7bc1 100644 --- a/test/install-script.test.mjs +++ b/test/install-script.test.mjs @@ -62,10 +62,10 @@ test( } ); -test("interactive installer presents Hermes colors as the default", async () => { +test("interactive installer presents Rainbow Color as the default", async () => { const source = await readFile(installScript, "utf8"); - assert.match(source, /Hermes 彩色状态栏(全新安装默认启用)/); + assert.match(source, /Rainbow Color 彩色状态栏(全新安装默认启用)/); assert.match(source, /四段式状态栏?\[Y\/n\]/); assert.match(source, /IsNullOrWhiteSpace\(\$answer\)/); assert.match(source, /Join-Path \$installRoot 'state\.json'/); diff --git a/test/installer/uninstall.test.mjs b/test/installer/uninstall.test.mjs index 66b62b5..8046885 100644 --- a/test/installer/uninstall.test.mjs +++ b/test/installer/uninstall.test.mjs @@ -50,10 +50,10 @@ test("uninstall removes CCU PATH and preferences before falling back to official }); await Promise.all([ writeFile(join(codexHome, "ui-language"), "zh-CN\n", "utf8"), - writeFile(join(codexHome, "ui-theme"), "ccu.deepseek\n", "utf8"), + writeFile(join(codexHome, "ui-theme"), "rainbow_color\n", "utf8"), writeFile( join(codexHome, "ui-statusline-preset"), - "ccu.deepseek\n", + "rainbow_color\n", "utf8" ) ]); diff --git a/test/manage-main.test.mjs b/test/manage-main.test.mjs index 329b016..f00631f 100644 --- a/test/manage-main.test.mjs +++ b/test/manage-main.test.mjs @@ -177,7 +177,7 @@ test("update passes the latest validated fork release to the installer", async ( contentOptions = options; return { language: { locale: "zh-CN", messages: 134 }, - theme: { id: "ccu.hermes", displayName: "Hermes 风格" }, + theme: { id: "rainbow_color", displayName: "Rainbow Color" }, codexHome: "C:\\Users\\me\\.codex" }; }, @@ -219,7 +219,7 @@ test("current install schedules cleanup for a release locked by the active sessi contentRefreshed = true; return { language: { locale: "zh-CN", messages: 134 }, - theme: { id: "ccu.hermes", displayName: "Hermes 风格" }, + theme: { id: "rainbow_color", displayName: "Rainbow Color" }, codexHome: "C:\\Users\\me\\.codex" }; }, @@ -240,7 +240,7 @@ test("current install schedules cleanup for a release locked by the active sessi assert.deepEqual(report.deferredReleases, ["0.144.5-ccu.i18n.0"]); assert.equal(report.cleanupScheduled, true); assert.equal(cleanupScheduled, true); - assert.equal(report.content.theme.id, "ccu.hermes"); + assert.equal(report.content.theme.id, "rainbow_color"); assert.equal(binRefreshed, true); assert.equal(contentRefreshed, true); }); @@ -260,13 +260,13 @@ test("hidden cleanup command waits for inactive releases without user output", a assert.equal(called, true); }); -test("fresh install defaults to Hermes colors and honors explicit overrides", async () => { +test("fresh install defaults to Rainbow Color and honors explicit overrides", async () => { const latest = manifest(2); const cases = [ - { args: ["install", "--json"], expected: "ccu.hermes" }, + { args: ["install", "--json"], expected: "rainbow_color" }, { args: ["install", "--enable-statusline", "--json"], - expected: "ccu.hermes" + expected: "rainbow_color" }, { args: ["install", "--disable-statusline", "--json"], @@ -305,9 +305,9 @@ test("fresh install defaults to Hermes colors and honors explicit overrides", as return { language: { locale: "zh-CN", messages: 1396 }, theme: { - id: "ccu.hermes", - displayName: "Hermes 风格", - statusLinePresetEnabled: options.statusLinePreset === "ccu.hermes" + id: "rainbow_color", + displayName: "Rainbow Color", + statusLinePresetEnabled: options.statusLinePreset === "rainbow_color" }, codexHome: "C:\\Users\\me\\.codex" }; diff --git a/test/theme.test.mjs b/test/theme.test.mjs index 182cd19..27543b1 100644 --- a/test/theme.test.mjs +++ b/test/theme.test.mjs @@ -56,6 +56,45 @@ test("theme validator accepts Hermes emoji and palette metadata", () => { assert.deepEqual(validated.statusLine.palette, ["#f5e0dc", "#94e2d5"]); }); +test("theme validator accepts rainbow_color surfaces without background fills", () => { + const source = themePack({ + randomizePalette: false, + softenColors: false + }); + source.id = "rainbow_color"; + source.welcome = { + ...source.welcome, + border: "#89DCEB", + command: "#89DCEB", + badge: "#F5C2E7" + }; + source.statusCard = { + border: "#89DCEB", + title: "#89DCEB", + version: "#F5E0DC", + label: "#89DCEB", + model: "#F2CDCD", + path: "#A6E3A1", + permissions: "#FAB387", + usage: "#89DCEB", + progress: "#A6E3A1", + percent: "#74C7EC", + limits: "#F9E2AF", + link: "#89DCEB", + value: "#CDD6F4" + }; + source.dialog = { selection: "#89DCEB", background: null }; + source.composer = { background: null }; + + const validated = validateThemePack(source); + assert.equal(validated.id, "rainbow_color"); + assert.equal(validated.statusLine.randomizePalette, false); + assert.equal(validated.statusLine.softenColors, false); + assert.equal(validated.welcome.border, "#89dceb"); + assert.deepEqual(validated.dialog, { selection: "#89dceb", background: null }); + assert.deepEqual(validated.composer, { background: null }); +}); + test("theme validator rejects unknown model reasoning formats", () => { assert.throws( () => validateThemePack(themePack({ modelReasoningStyle: "template" })), @@ -96,3 +135,27 @@ test("bundled Hermes theme uses the Macchiato-inspired color roles", async () => "#c6a0f6" ]); }); + +test("bundled rainbow_color theme matches the approved V3 palette", async () => { + const source = JSON.parse( + await readFile( + new URL("../packages/themes/rainbow_color/theme.json", import.meta.url), + "utf8" + ) + ); + const validated = validateThemePack(source); + + assert.equal(validated.id, "rainbow_color"); + assert.deepEqual(validated.statusLine.colors, { + model: "#f5e0dc", + usage: "#f5c2e7", + progress: "#a6e3a1", + time: "#f9e2af", + quota: "#fab387", + separator: "#cba6f7" + }); + assert.equal(validated.welcome.border, "#89dceb"); + assert.equal(validated.statusCard.label, "#89dceb"); + assert.equal(validated.dialog.background, null); + assert.equal(validated.composer.background, null); +}); diff --git a/tui/src/main.rs b/tui/src/main.rs index a183328..5b94d65 100644 --- a/tui/src/main.rs +++ b/tui/src/main.rs @@ -1466,12 +1466,12 @@ fn draw_language(frame: &mut ratatui::Frame, area: ratatui::layout::Rect, app: & fn draw_theme(frame: &mut ratatui::Frame, area: ratatui::layout::Rect, app: &App) { let installed = PathBuf::from(&app.status.install_root) .join("themes") - .join("ccu.hermes") + .join("rainbow_color") .join("theme.json") .is_file(); let lines = vec![ Line::from(vec![ - Span::styled("Hermes 风格:", Style::default().fg(MUTED)), + Span::styled("Rainbow Color:", Style::default().fg(MUTED)), Span::styled( if installed { "已安装" } else { "缺失" }, Style::default().fg(if installed { SUCCESS } else { DANGER }), @@ -1481,21 +1481,22 @@ fn draw_theme(frame: &mut ratatui::Frame, area: ratatui::layout::Rect, app: &App Line::from(vec![ Span::styled( "🦊 gpt-5.6-sol[xhigh]", - Style::default().fg(Color::Rgb(148, 226, 213)), + Style::default().fg(Color::Rgb(245, 224, 220)), ), Span::styled(" │ ", Style::default().fg(Color::Rgb(203, 166, 247))), - Span::styled("42.7K/353K", Style::default().fg(Color::Rgb(137, 220, 235))), - Span::styled(" │ ", Style::default().fg(Color::Rgb(245, 194, 231))), + Span::styled("42.7K/353K", Style::default().fg(Color::Rgb(245, 194, 231))), + Span::styled(" │ ", Style::default().fg(Color::Rgb(203, 166, 247))), Span::styled( "[█░░░░░░░░░] 9%", Style::default().fg(Color::Rgb(166, 227, 161)), ), - Span::styled(" │ ", Style::default().fg(Color::Rgb(250, 179, 135))), + Span::styled(" │ ", Style::default().fg(Color::Rgb(203, 166, 247))), Span::styled("⏱ 1s ⚡0s", Style::default().fg(Color::Rgb(249, 226, 175))), - Span::styled(" │ ", Style::default().fg(Color::Rgb(242, 205, 205))), + Span::styled(" │ ", Style::default().fg(Color::Rgb(203, 166, 247))), ]), Line::from(""), - Line::from("主题 schema 已支持随机模型 emoji、Hermes 调色板、进度条和欢迎页颜色。"), + Line::from("rainbow_color 使用固定 Claude Code 状态栏配色,并保留随机模型 emoji。"), + Line::from("Welcome、/status、弹窗与输入条统一使用 Sky 主色;Hermes 旧主题仍随包保留。"), Line::from("按 f 在后台同步主题;后续主题包放入 themes//theme.json。"), ]; frame.render_widget(