feat: restore Orven iris purple appearance with remembered defaults

This commit is contained in:
Agent Workbench Dev
2026-11-06 14:46:19 +08:00
parent 1763d90db7
commit 02043f6f8b
20 changed files with 291 additions and 38 deletions
+1 -1
View File
@@ -12,7 +12,7 @@
字体为 Segoe UI Variable/Segoe UI 与 Microsoft YaHei UI,代码为 Cascadia Code/Consolas。对话 14px/1.9,导航 12px,说明 11px,元数据 10px;首页问候 28–34px,字标 26px。兼顾中文、英文模型名和长路径。
「外观」提供默认深青绿与可选雾蓝,后者来自用户参考图的 #4F6EF7 靛蓝、#F6F8FC 画布、#EDF1FF 选中和 #24334B 正文;白字按钮稍加深为 #4563E6,强调文字用 #3D58CD。公共 `orven-palettes.css` 定义角色颜色,界面样式引用变量,成功/错误/审批和差异保持语义。右上角与工具箱均有入口,单选即时应用并保存,不刷新或重建任务。桌面/手机使用同一选择面板,偏好按本机浏览器保存。
「外观」提供深青绿、雾蓝和鸢尾紫三套配色。雾蓝来自用户参考图的 #4F6EF7 靛蓝、#F6F8FC 画布、#EDF1FF 选中和 #24334B 正文;白字按钮稍加深为 #4563E6,强调文字用 #3D58CD。鸢尾紫恢复初版 #6253B5 操作、#F5F5F8 导航、纯白工作区、#37333F 正文和 #E9E5F3 选中底色。公共 `orven-palettes.css` 定义角色颜色,成功/错误/审批和差异保持语义。右上角与工具箱均有入口,单选即时应用并保存,不刷新或重建任务;首次深青绿,以后默认恢复最后选择。桌面三列,600px 及以下纵向展示三套预览;桌面/手机共用面板,偏好按本机浏览器来源保存,同源标签页同步。
桌面侧栏 242px,成果区默认 430px 并可调整。940px 以下成果区成为抽屉,620px 以下导航也成为抽屉。输入始终在视口底部,内容内部滚动。长路径截断并可查看完整 title,代码保留横向滚动。控件保留可见焦点、弹窗焦点约束和减少动态效果支持。桌面、390px 及异常状态实际渲染验收。
+5 -2
View File
@@ -48,15 +48,18 @@ Orven 理解你的项目,和你一起研究问题、编写代码,把想法
图形由开放环线和前向笔画构成:项目正在被理解与形成,工作继续向前。字标采用紧凑但可读的自然字形,应用图标采用单色深青绿底和白色图形。
品牌主色为深青绿 **#176B5B**,配合松墨 **#28382F**、雾灰 **#F3F6F4** 与白色画布。选中和聚焦使用浅绿 **#E7F2EB**;错误、确认与文件差异保持各自的状态语义。此配色取代初版鸢尾色,使 Orven 与用户已有产品形成区别。
品牌主色为深青绿 **#176B5B**,配合松墨 **#28382F**、雾灰 **#F3F6F4** 与白色画布。选中和聚焦使用浅绿 **#E7F2EB**;错误、确认与文件差异保持各自的状态语义。深青绿用于品牌展示与首次打开工作台,日常工作台配色由用户选择。
工作台提供可选「雾蓝」外观:靛蓝 **#4F6EF7**、雾蓝白画布 **#F6F8FC**、深蓝灰正文 **#24334B**、选中 **#EDF1FF**。依据用户提供的数字教材工作台截图提取配色,保留 Orven 的结构与标识;白字按钮用 **#4563E6**,小字强调用 **#3D58CD**,保证阅读对比。右上角调色盘或「工具箱 → 外观」立即切换,深青绿仍为默认。
工作台提供可选「雾蓝」外观:靛蓝 **#4F6EF7**、雾蓝白画布 **#F6F8FC**、深蓝灰正文 **#24334B**、选中 **#EDF1FF**。依据用户提供的数字教材工作台截图提取配色,保留 Orven 的结构与标识;白字按钮用 **#4563E6**,小字强调用 **#3D58CD**,保证阅读对比。
第三套「鸢尾紫」恢复初版视觉:紫色操作 **#6253B5**、浅灰导航 **#F5F5F8**、纯白工作区、正文 **#37333F**、选中 **#E9E5F3**、强调底色 **#EFECF9**。右上角调色盘或「工具箱 → 外观」展示三套配色,点击立即生效,并将最后选择设为以后打开时的默认配色。桌面三列并排预览,600px 及以下改为纵向排列,完整保留三项预览和保存状态。
选择保存在当前浏览器或桌面窗口所属的本地配置中,刷新和重新打开时恢复;同源标签页同步,手机按自己的浏览器选择。安装图标和品牌页保留深青绿,应用内标识、桌面浏览器图标与网页主题色随配色改变。手机图标沿用配对网关已允许的资源路径。
- `public/brand/orven-symbol.svg`:透明图形标。
- `public/brand/orven-wordmark.svg`:横向图文标;使用 Segoe UI,跨平台交换前需确认字体或转曲。
- `public/favicon.svg`、`public/mobile-icon.svg`:应用图标。
- `public/brand/orven-icon-blue.svg`、`orven-icon-purple.svg`:可选外观的浏览器图标。
- `public/workbench-icon.png`、`.ico`:桌面图标,沿用原资源路径保持启动器兼容。
- `public/brand.html`:可直接打开的品牌展示页。
+13
View File
@@ -65,6 +65,19 @@
复验命令为 `npm run verify:appearance`。现有主路径默认深青绿,设置 `ORVEN_QA_PALETTE=blue` 则验雾蓝。偏好按浏览器来源保存,同源多页同步,实际手机各自保存;未声称跨设备同步或实际 iPhone 配对。品牌展示页与安装图标沿用深青绿,本轮不涉及桌面宿主生命周期和正式安装。
## 三套配色与重新打开记忆
恢复初版「鸢尾紫」为第三套选择:#6253B5 操作、#F5F5F8 导航、纯白工作区、#37333F 正文。三套均使用同一偏好保存机制,首次打开为深青绿,之后恢复最后选择;面板明确显示「已设为默认配色,下次打开会继续使用」。桌面三列,600px 及以下纵排。
本轮 Node24 下 TypeScript、Vite 与 mobile shell 构建通过。紫色现有主路径 10 组通过,3 次本机协议夹具请求、0 真实模型、0 pageerror;外观 7 组通过,0 后端写请求。使用自有临时磁盘 profile,实际选择雾蓝、关闭浏览器并重启核对恢复,再对深青绿和鸢尾紫分别重复;未注入 storageState 或使用用户浏览器配置。另验证刷新/同源多页、原生键盘和焦点返回、紫色一次性链接、无效值回退、存储不可用提示,以及 600/390/320px 面板和实际伴随端 shell。
- [紫色 10 组主路径](evidence/themes-purple-result.json)
- [三套外观 7 组及文字对比](evidence/appearance-three-palettes-result.json):13 个 DOM 样本,其中紫色 6 个样本为 4.96:1–7.64:1,白字按钮 6.13:1。
- [紫色工作台](screenshots/purple-desktop.png)、[任务与差异](screenshots/purple-task-results.png)、[390px 会话](screenshots/purple-mobile.png)。
- [三套配色面板](screenshots/appearance-three-palettes.png)、[390px 选择面板](screenshots/appearance-three-palettes-mobile.png)。
实际查看上述桌面/差异、320/390px 和伴随端截图,三套选项及保存提示均完整可见。复验命令为 `npm run verify:appearance`;`ORVEN_QA_PALETTE=purple` 配合 `npm run verify:orven` 验紫色主路径。原两套测试记录保持,未重跑桌面宿主生命周期或正式安装。
## 边界
全部模型执行来自明确的本机测试接口;未用真实供应商验证新的模型能力。手机伴随端完成品牌和主题,主工作台窄屏已经实际验收;本轮未进行真实 iPhone 配对。安装器显示名更新仅在源码,未重制安装包或更改正式安装。名称的商标、域名和商店可用性尚未核验。
@@ -0,0 +1,95 @@
{
"checks": [
"visible appearance choice updates all surfaces, favicon and metadata; draft survives switching and selection survives reload",
"native keyboard selection, focus return and cross-tab preference sync work without backend mutations",
"original purple palette restores white workspace and gray navigation, updates metadata and persists across reload and tabs",
"preview links select once and preserve other URL data; latest selection wins on reload and invalid stored choices recover",
"600px, 390px and 320px panels fit all three choices; actual companion shell retains local preference and gateway icon",
"unavailable preference storage keeps switching usable and reports that the choice was not saved",
"each palette survives a full browser close and relaunch using the same isolated persistent profile"
],
"contrast": [
{
"label": "blue appearance description",
"foreground": "rgb(98, 113, 138)",
"background": "rgb(255, 255, 255)",
"ratio": 4.94
},
{
"label": "blue saved state",
"foreground": "rgb(98, 113, 138)",
"background": "rgb(255, 255, 255)",
"ratio": 4.94
},
{
"label": "blue welcome text",
"foreground": "rgb(82, 100, 127)",
"background": "rgb(246, 248, 252)",
"ratio": 5.66
},
{
"label": "blue selected navigation",
"foreground": "rgb(61, 88, 205)",
"background": "rgb(248, 250, 255)",
"ratio": 5.79
},
{
"label": "blue primary action",
"foreground": "rgb(255, 255, 255)",
"background": "rgb(69, 99, 230)",
"ratio": 5.02
},
{
"label": "blue model category",
"foreground": "rgb(61, 88, 205)",
"background": "rgb(237, 241, 255)",
"ratio": 5.36
},
{
"label": "green appearance description",
"foreground": "rgb(95, 112, 102)",
"background": "rgb(255, 255, 255)",
"ratio": 5.26
},
{
"label": "purple appearance description",
"foreground": "rgb(113, 105, 121)",
"background": "rgb(255, 255, 255)",
"ratio": 5.25
},
{
"label": "purple saved state",
"foreground": "rgb(113, 105, 121)",
"background": "rgb(255, 255, 255)",
"ratio": 5.25
},
{
"label": "purple welcome text",
"foreground": "rgb(87, 81, 95)",
"background": "rgb(255, 255, 255)",
"ratio": 7.64
},
{
"label": "purple selected navigation",
"foreground": "rgb(98, 83, 181)",
"background": "rgb(245, 245, 248)",
"ratio": 5.64
},
{
"label": "purple primary action",
"foreground": "rgb(255, 255, 255)",
"background": "rgb(98, 83, 181)",
"ratio": 6.13
},
{
"label": "purple model category",
"foreground": "rgb(98, 83, 181)",
"background": "rgb(233, 229, 243)",
"ratio": 4.96
}
],
"errors": [],
"backendMutations": [],
"realModelCalls": 0,
"userDataAccessed": false
}
@@ -0,0 +1,20 @@
{
"palette": "purple",
"checks": [
"Orven identity, actual project context and focused new-task surface",
"starter prompts do not execute; missing model preserves input and opens connection setup",
"tool search, no-result recovery, keyboard selection and real file preview preserve the draft",
"model creation and selection persist across refresh; setup emits no model requests",
"real three-request local protocol flow reads and writes the owned project; diff and conversation survive refresh",
"permission choice is saved and restored rather than shown as a cosmetic selection",
"external file conflict preserves external bytes and unsaved editor input, with a visible recovery message",
"1280/1024/768/390 layouts keep the document contained; mobile navigation and result drawer work",
"skills, MCP and diagnostics remain connected through the new tool navigation",
"brand page, interactive mark backgrounds and downloadable SVG/PNG/ICO assets render without browser errors"
],
"errors": [],
"modelCalls": 3,
"realModelCalls": 0,
"fixtureOnly": true,
"userDataAccessed": false
}
+4
View File
@@ -29,3 +29,7 @@
- 用户提供新参考图后,新增「雾蓝」外观,保留默认深青绿。统一为公共角色颜色变量,两套配色覆盖工作台、文件/成果、模型中心及工具面板;手机伴随端共用外观面板。右上角与工具箱均可打开,选择即时保存,同源多页同步,存储不可用有实际反馈;预览链接只选择一次,不覆盖之后的用户选择。
- TypeScript/Vite/mobile shell 构建通过,两套各 10 组任务主路径及外观 5 组通过;0 真实模型、0 用户数据,外观切换 0 后端写请求。7 个文字对比样本 4.94:1–5.79:1。已检查雾蓝桌面/差异、外观选择与手机端真实渲染;本轮未改变品牌页和安装图标,不制作发行包或替换正式安装。
- 按用户最新要求,恢复初版「鸢尾紫」为第三套外观,接入公共颜色、网页图标和初始化校验。保存提示明确为「已设为默认配色,下次打开会继续使用」。桌面面板三列,600px 及以下纵向展示,320px 仍完整可见。
- Node24 下 TypeScript、Vite 与 mobile shell 构建通过;紫色任务主路径 10 组、外观 7 组通过。三套分别在自有持久化浏览器配置中完全关闭、重新启动后恢复,刷新/多页/一次性链接/异常保存/手机入口也通过;外观 0 后端写入、0 pageerror。紫色 6 个实际 DOM 对比样本为 4.96:1–7.64:1。
- 已实际查看紫色桌面、文件差异、三套选择面板、390/320px 及伴随端渲染,保存新截图和本轮证据,不覆盖原两套验收记录。交付仍为本地源码与独立 4327 预览;正式服务和并行后端修改不纳入本次提交。
Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

+6
View File
@@ -32,3 +32,9 @@
用户补充参考图后,保留默认深青绿,新增「雾蓝」可选主题。参考图实际像素为强调 #4F6EF7、画布 #F6F8FC、选中 #EDF1FF、正文 #24334B;白字按钮采用更深的 #4563E6,小字强调用 #3D58CD。沿用现有布局与任务流程,通过公共颜色变量覆盖文件、模型中心与工具面板。
实现右上角及工具箱「外观」入口、原生单选与即时切换、本机浏览器保存和同源多标签页同步、手机伴随端入口;初始化在 React 渲染前应用选择。验证包含两套各 10 组主路径、切换/保存/恢复/存储不可用 5 组以及实际截图和文字对比。
## 恢复鸢尾紫与默认记忆
用户回看初版后,恢复「鸢尾紫」为第三套可选外观;沿用初版紫色、浅灰导航和白色画布。三套预览桌面并排、窄屏纵排,明确最后选择就是下次打开时的默认配色。
实现与验收已完成:TypeScript/Vite/mobile shell、紫色 10 组主路径、外观 7 组通过。使用独立持久化浏览器配置,分别选择雾蓝、深青绿、鸢尾紫,每次完全关闭后重启确认恢复;另核对刷新、多页同步、预览链接、存储不可用、600/390/320px 与手机伴随端、实际文字对比。仅本地源码与独立预览,不制作发行包或升级正式安装。
+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><rect x="2" y="2" width="60" height="60" rx="16" fill="#6253b5"/><g transform="translate(11 11) scale(1.05)" fill="none" stroke="#fff" stroke-width="5.2" stroke-linecap="round" stroke-linejoin="round"><path d="M30.7 12.3a13.2 13.2 0 1 0 1.7 12.6"/><path d="m21.5 20 6.2 6.2L36 17.9"/></g></svg>

After

Width:  |  Height:  |  Size: 355 B

+84 -18
View File
@@ -1,5 +1,6 @@
import assert from 'node:assert/strict';
import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
import { chromium, expect } from 'playwright/test';
import { fixture, launchWorkbench } from '../tests/helpers.mjs';
@@ -12,13 +13,24 @@ const output = path.resolve('output/playwright/orven-appearance'); fs.mkdirSync(
const browser = await chromium.launch({ channel: 'msedge', headless: true });
const context = await browser.newContext({ viewport: { width: 1440, height: 960 } });
const page = await context.newPage(), checks = [], errors = [], mutations = [], contrast = [];
context.on('page', page => page.on('pageerror', error => errors.push(error.message)));
page.on('pageerror', error => errors.push(error.message));
context.on('request', request => { if (request.url().includes('/api/') && request.method() !== 'GET') mutations.push(request.method() + ' ' + new URL(request.url()).pathname); });
let persistent;
function observeContext(context) {
const observePage = page => page.on('pageerror', error => errors.push(error.message));
context.pages().forEach(observePage); context.on('page', observePage);
context.on('request', request => { if (request.url().includes('/api/') && request.method() !== 'GET') mutations.push(request.method() + ' ' + new URL(request.url()).pathname); });
}
observeContext(context);
const mark = value => { checks.push(value); console.log('PASS ' + value); };
const chosen = (page, palette) => expect(page.locator('html')).toHaveAttribute('data-palette', palette);
const appearance = () => page.getByRole('dialog', { name: '外观', exact: true });
const shot = name => page.screenshot({ path: path.join(output, name + '.png'), fullPage: true });
async function panelFits(page) {
const fits = await page.getByRole('dialog', { name: '外观', exact: true }).evaluate(dialog => {
const rect = dialog.getBoundingClientRect();
return rect.left >= 0 && rect.right <= innerWidth && rect.top >= 0 && rect.bottom <= innerHeight && dialog.scrollWidth <= dialog.clientWidth + 1 && dialog.scrollHeight <= dialog.clientHeight + 1;
});
assert.ok(fits, 'all three choices and saved state should fit within the viewport');
}
async function sample(locator, label) {
const colors = await locator.evaluate(element => {
let node = element, background = 'rgb(255, 255, 255)';
@@ -37,9 +49,10 @@ try {
await page.getByLabel('搜索工作台工具').fill('外观');
await page.getByRole('dialog', { name: '工具箱', exact: true }).getByRole('button', { name: '外观', exact: true }).click();
await expect(appearance().getByRole('radio', { name: '深青绿', exact: true })).toBeChecked();
await expect(appearance().getByRole('radio')).toHaveCount(3);
await appearance().getByRole('radio', { name: '雾蓝', exact: true }).check();
await chosen(page, 'blue');
await expect(page.locator('.appearance-note')).toContainText('已自动保存');
await expect(page.locator('.appearance-note')).toContainText('已设为默认配色,下次打开会继续使用');
await expect(page.locator('meta[name="theme-color"]')).toHaveAttribute('content', '#4f6ef7');
await expect(page.locator('link[rel="icon"]')).toHaveAttribute('href', '/brand/orven-icon-blue.svg');
assert.equal(await page.locator('.task-pane').evaluate(element => getComputedStyle(element).backgroundColor), 'rgb(246, 248, 252)');
@@ -68,10 +81,30 @@ try {
await page.keyboard.press('Escape');
await expect(page.getByRole('button', { name: '外观', exact: true })).toBeFocused();
await shot('green-desktop');
await other.close();
mark('native keyboard selection, focus return and cross-tab preference sync work without backend mutations');
await page.goto(host.url + '/?palette=blue&keep=1#review'); await chosen(page, 'blue');
await page.getByRole('button', { name: '外观', exact: true }).click();
await appearance().getByRole('radio', { name: '鸢尾紫', exact: true }).check();
await chosen(page, 'purple'); await chosen(other, 'purple');
await expect(page.locator('meta[name="theme-color"]')).toHaveAttribute('content', '#6253b5');
await expect(page.locator('link[rel="icon"]')).toHaveAttribute('href', '/brand/orven-icon-purple.svg');
assert.equal(await page.locator('.task-pane').evaluate(element => getComputedStyle(element).backgroundColor), 'rgb(255, 255, 255)');
assert.equal(await page.locator('.project-sidebar').evaluate(element => getComputedStyle(element).backgroundColor), 'rgb(245, 245, 248)');
await sample(page.locator('.appearance-choice.selected .appearance-choice-description'), 'purple appearance description');
await sample(page.locator('.appearance-note'), 'purple saved state');
await panelFits(page); await shot('appearance-purple');
await page.keyboard.press('Escape');
await sample(page.locator('.orven-welcome > p'), 'purple welcome text');
await sample(page.locator('.sidebar-view-tabs button[aria-selected="true"]'), 'purple selected navigation');
await shot('purple-desktop');
await page.getByRole('button', { name: '选择与管理模型', exact: true }).click();
await sample(page.getByRole('button', { name: '从上游添加模型', exact: true }), 'purple primary action');
await sample(page.locator('.mc-tabs button[aria-current="page"]'), 'purple model category');
await page.keyboard.press('Escape');
await page.reload(); await chosen(page, 'purple'); await other.close();
mark('original purple palette restores white workspace and gray navigation, updates metadata and persists across reload and tabs');
await page.goto(host.url + '/?palette=purple&keep=1#review'); await chosen(page, 'purple');
assert.equal(new URL(page.url()).search, '?keep=1'); assert.equal(new URL(page.url()).hash, '#review');
await page.getByRole('button', { name: '外观', exact: true }).click();
await appearance().getByRole('radio', { name: '深青绿', exact: true }).check();
@@ -80,42 +113,75 @@ try {
await page.reload(); await chosen(page, 'green');
mark('preview links select once and preserve other URL data; latest selection wins on reload and invalid stored choices recover');
await page.goto(host.url + '/?palette=blue'); await page.locator('.connection.connected').waitFor();
await page.setViewportSize({ width: 390, height: 844 });
await page.getByRole('button', { name: '外观', exact: true }).click();
await expect(appearance().getByRole('radio', { name: '雾蓝', exact: true })).toBeChecked();
await shot('appearance-mobile'); await page.keyboard.press('Escape');
await page.goto(host.url + '/mobile.html'); await chosen(page, 'blue');
await page.goto(host.url + '/?palette=purple'); await page.locator('.connection.connected').waitFor();
for (const viewport of [{ width: 600, height: 900 }, { width: 320, height: 740 }, { width: 390, height: 844 }]) {
await page.setViewportSize(viewport);
await page.getByRole('button', { name: '外观', exact: true }).click();
await expect(appearance().getByRole('radio')).toHaveCount(3);
await expect(appearance().getByRole('radio', { name: '鸢尾紫', exact: true })).toBeChecked();
await panelFits(page); await shot('appearance-' + viewport.width); await page.keyboard.press('Escape');
}
await page.goto(host.url + '/mobile.html'); await chosen(page, 'purple');
await expect(page.locator('link[rel="icon"]')).toHaveAttribute('href', '/mobile-icon.svg');
await page.getByRole('button', { name: '外观', exact: true }).click();
await expect(appearance().getByRole('radio', { name: '雾蓝', exact: true })).toBeChecked();
await expect(appearance().getByRole('radio', { name: '鸢尾紫', exact: true })).toBeChecked();
await appearance().getByRole('radio', { name: '深青绿', exact: true }).check();
await page.keyboard.press('Escape'); await page.reload(); await chosen(page, 'green');
await page.getByRole('button', { name: '外观', exact: true }).click();
await appearance().getByRole('radio', { name: '雾蓝', exact: true }).check();
await shot('companion-appearance');
await appearance().getByRole('radio', { name: '鸢尾紫', exact: true }).check();
await panelFits(page); await shot('companion-appearance');
const overflow = await page.evaluate(() => document.documentElement.scrollWidth > innerWidth + 1);
assert.equal(overflow, false);
mark('390px workbench and actual companion shell expose the same two choices and retain local preference');
mark('600px, 390px and 320px panels fit all three choices; actual companion shell retains local preference and gateway icon');
const restricted = await browser.newContext({ viewport: { width: 390, height: 844 } });
observeContext(restricted);
await restricted.addInitScript(() => {
const original = Storage.prototype.setItem;
Storage.prototype.setItem = function (key, value) { if (key === 'orven-palette') throw new DOMException('Storage unavailable', 'QuotaExceededError'); return original.call(this, key, value); };
});
const limited = await restricted.newPage(); limited.on('pageerror', error => errors.push(error.message));
const limited = await restricted.newPage();
await limited.goto(host.url); await limited.locator('.connection.connected').waitFor({ state: 'attached' });
await limited.getByRole('button', { name: '外观', exact: true }).click();
await limited.getByRole('radio', { name: '雾蓝', exact: true }).check(); await chosen(limited, 'blue');
await limited.getByRole('radio', { name: '鸢尾紫', exact: true }).check(); await chosen(limited, 'purple');
await expect(limited.locator('.appearance-note')).toContainText('暂时无法保存');
await limited.reload(); await chosen(limited, 'green'); await restricted.close();
mark('unavailable preference storage keeps switching usable and reports that the choice was not saved');
// Use an isolated on-disk profile: no injected storage state or user's browser profile.
const profile = fs.mkdtempSync(path.join(os.tmpdir(), 'orven-appearance-'));
assert.equal(path.dirname(path.resolve(profile)), path.resolve(os.tmpdir()));
disposers.push(() => fs.rmSync(profile, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }));
async function reopen() {
persistent = await chromium.launchPersistentContext(profile, { channel: 'msedge', headless: true, viewport: { width: 1440, height: 960 } });
observeContext(persistent);
const reopened = persistent.pages()[0] ?? await persistent.newPage();
await reopened.goto(host.url); await reopened.locator('.connection.connected').waitFor({ state: 'attached' });
return reopened;
}
let reopened = await reopen();
for (const [palette, name] of [['blue', '雾蓝'], ['green', '深青绿'], ['purple', '鸢尾紫']]) {
await reopened.keyboard.press('Escape');
await reopened.getByRole('button', { name: '外观', exact: true }).click();
await reopened.getByRole('radio', { name, exact: true }).check();
await chosen(reopened, palette);
await expect(reopened.locator('.appearance-note')).toContainText('下次打开会继续使用');
await persistent.close(); persistent = undefined;
reopened = await reopen(); await chosen(reopened, palette);
assert.equal(await reopened.evaluate(() => localStorage.getItem('orven-palette')), palette);
await reopened.getByRole('button', { name: '外观', exact: true }).click();
await expect(reopened.getByRole('radio', { name, exact: true })).toBeChecked();
}
await reopened.screenshot({ path: path.join(output, 'reopened-purple.png'), fullPage: true });
await persistent.close(); persistent = undefined;
mark('each palette survives a full browser close and relaunch using the same isolated persistent profile');
assert.deepEqual(errors, []); assert.deepEqual(mutations, []);
fs.writeFileSync(path.join(output, 'result.json'), JSON.stringify({ checks, contrast, errors, backendMutations: mutations, realModelCalls: 0, userDataAccessed: false }, null, 2));
} catch (error) {
await shot('failure').catch(() => {});
fs.writeFileSync(path.join(output, 'failure.json'), JSON.stringify({ checks, errors, message: error.message }, null, 2)); throw error;
} finally {
await persistent?.close();
await browser.close(); for (const dispose of disposers.reverse()) await dispose();
}
+2 -2
View File
@@ -6,8 +6,8 @@ import { fixture, compatibleFixture, completion, call, launchWorkbench } from '.
// Real browser + real isolated host + local protocol fixture. No real model or user project.
const palette = process.env.ORVEN_QA_PALETTE ?? 'green';
assert.ok(['green', 'blue'].includes(palette));
const output = path.resolve('output/playwright/' + (palette === 'blue' ? 'orven-blue' : 'orven'));
assert.ok(['green', 'blue', 'purple'].includes(palette));
const output = path.resolve('output/playwright/' + (palette === 'green' ? 'orven' : 'orven-' + palette));
fs.mkdirSync(output, { recursive: true });
const disposers = [], t = { after: dispose => disposers.push(dispose) };
const f = fixture(t, { modernDefaults: true });
+1 -1
View File
@@ -573,7 +573,7 @@ export default function App() {
{ id: 'rea', label: 'REA 工件研究', description: '研究应用工件,核对分析证据', group: '能力与研究', icon: BookOpenText, disabled: !selectedProject || creatingSession || restrictedWorker, reason: '请先选择可编辑的项目', run: () => void openRea() },
{ id: 'research', label: '机制研究与设计', description: '阅读已有研究报告与机制说明', group: '能力与研究', icon: BookOpenText, run: () => void openResearch() },
{ id: 'models', label: '模型中心', description: '选择模型、管理连接和模型池', group: '设置与连接', icon: ModelServer, run: () => setModelCenterOpen(true) },
{ id: 'appearance', label: '外观', description: '在深青绿和雾蓝之间选择工作台配色', group: '设置与连接', icon: PaletteIcon, run: () => setAppearanceOpen(true) },
{ id: 'appearance', label: '外观', description: '选择深青绿、雾蓝或鸢尾紫,自动记住你的偏好', group: '设置与连接', icon: PaletteIcon, run: () => setAppearanceOpen(true) },
{ id: 'diagnostics', label: '运行诊断', description: '检查连接、终端与最近错误', group: '设置与连接', icon: Activity, run: () => void openDiagnostics() },
{ id: 'companion', label: '手机连接', description: '在手机上查看和接续电脑任务', group: '设置与连接', icon: Link2, run: () => setCompanionOpen(true) },
...(desktop ? [{ id: 'desktop', label: '桌面宿主', description: '查看窗口、后台任务与本地宿主', group: '设置与连接', icon: SquareTerminal, run: () => setDesktopOpen(true) }] : []),
+2 -1
View File
@@ -6,6 +6,7 @@ import './appearance.css';
const choices = [
{ id: 'green', name: '深青绿', description: '沉静的绿,配合雾灰与松墨。', accent: '#176b5b', canvas: '#f3f6f4', selected: '#dfede4', ink: '#28382f' },
{ id: 'blue', name: '雾蓝', description: '通透的雾蓝白,配合靛蓝与深蓝灰。', accent: '#4f6ef7', canvas: '#f6f8fc', selected: '#edf1ff', ink: '#24334b' },
{ id: 'purple', name: '鸢尾紫', description: '柔和的紫,配合浅灰与纯白。', accent: '#6253b5', canvas: '#f5f5f8', selected: '#e9e5f3', ink: '#37333f' },
] as const;
export function AppearancePanel() {
@@ -18,6 +19,6 @@ export function AppearancePanel() {
<span className="appearance-choice-description">{choice.description}</span>
<span className="appearance-swatches" aria-hidden="true"><i /><i /><i /></span>
</label>)}</fieldset>
<p className="appearance-note" role="status">{saved ? '已自动保存。工作台、文件与成果区、工具面板会一起切换。' : '本次配色已切换,但浏览器暂时无法保存;刷新后可能恢复默认配色。'}</p>
<p className="appearance-note" role="status">{saved ? '已设为默认配色,下次打开会继续使用。工作台、文件与成果区、工具面板会一起切换。' : '本次配色已切换,但浏览器暂时无法保存;刷新后可能恢复默认配色。'}</p>
</div>;
}
+12 -9
View File
@@ -1,10 +1,10 @@
.modal-backdrop:has(.appearance-panel) { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgb(var(--orven-shadow-rgb) / 33%); backdrop-filter: blur(2px); }
.modal:has(.appearance-panel) { box-sizing: border-box; width: min(620px, 100%); max-height: calc(100dvh - 40px); overflow: auto; padding: 26px; background: #fff; border: 1px solid var(--orven-border); border-radius: 14px; color: var(--orven-text); box-shadow: 0 24px 100px rgb(var(--orven-shadow-rgb) / 19%); }
.modal:has(.appearance-panel) { box-sizing: border-box; width: min(720px, 100%); max-width: 720px; max-height: calc(100dvh - 40px); overflow: auto; padding: 26px; background: #fff; border: 1px solid var(--orven-border); border-radius: 14px; color: var(--orven-text); box-shadow: 0 24px 100px rgb(var(--orven-shadow-rgb) / 19%); }
.modal:has(.appearance-panel) .modal-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.modal:has(.appearance-panel) .modal-heading h2 { margin: 0; color: var(--orven-ink); font-size: 20px; font-weight: 600; line-height: 1.4; }
.modal:has(.appearance-panel) .modal-heading p { margin: 8px 0 0; color: var(--orven-muted); font-size: 12px; line-height: 1.8; }
.modal:has(.appearance-panel) .modal-heading .icon-button { display: grid; place-items: center; min-height: 32px; width: 32px; height: 32px; padding: 0; background: transparent; border: 0; border-radius: 6px; color: var(--orven-text); }
.appearance-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 0; margin: 24px 0 0; border: 0; min-width: 0; }
.appearance-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; padding: 0; margin: 24px 0 0; border: 0; min-width: 0; }
.appearance-choices legend { padding: 0 0 14px; color: var(--orven-heading); font-size: 13px; font-weight: 600; }
.appearance-choice { position: relative; display: flex; flex-direction: column; min-width: 0; padding: 11px; border: 1px solid var(--orven-border); border-radius: 10px; cursor: pointer; background: #fff; }
.appearance-choice.selected { border-color: var(--orven-accent); box-shadow: 0 0 0 1px var(--orven-accent); }
@@ -26,18 +26,21 @@
.appearance-choice-title strong { font-weight: 600; }
.appearance-selected { display: grid; place-items: center; height: 20px; width: 20px; border: 1px solid var(--orven-border); border-radius: 50%; }
.selected .appearance-selected { color: #fff; background: var(--orven-action); border-color: var(--orven-action); }
.appearance-choice-description { margin: 7px 2px 0; color: var(--orven-muted); font-size: 11px; line-height: 1.8; }
.appearance-choice-description { margin: 7px 2px 0; min-height: 40px; color: var(--orven-muted); font-size: 11px; line-height: 1.8; }
.appearance-swatches { display: flex; gap: 5px; margin: 13px 2px 3px; }
.appearance-swatches i { width: 12px; height: 12px; border-radius: 50%; border: 1px solid #24334b14; background: var(--preview-accent); }
.appearance-swatches i:nth-child(2) { background: var(--preview-ink); }
.appearance-swatches i:nth-child(3) { background: var(--preview-canvas); }
.appearance-note { margin: 22px 0 0; padding-top: 16px; border-top: 1px solid var(--orven-border-soft); color: var(--orven-muted); font-size: 11px; line-height: 1.9; }
@media (max-width: 420px) {
@media (max-width: 600px) {
.modal-backdrop:has(.appearance-panel) { padding: 12px; }
.modal:has(.appearance-panel) { padding: 20px 18px; max-height: calc(100dvh - 24px); }
.appearance-choices { gap: 11px; }
.appearance-choice { padding: 8px; }
.appearance-preview { height: 103px; }
.appearance-preview-work { padding: 18px 9px 10px; }
.appearance-choice-description { min-height: 39px; font-size: 10px; }
.appearance-choices { grid-template-columns: 1fr; gap: 12px; margin-top: 18px; }
.appearance-choice { display: grid; grid-template-columns: 104px minmax(0, 1fr); column-gap: 14px; padding: 10px; }
.appearance-preview { grid-row: 1 / 4; height: 92px; }
.appearance-preview-nav { padding: 13px 5px; }
.appearance-preview-work { padding: 16px 8px 10px; }
.appearance-choice-title { margin: 3px 0 0; }
.appearance-choice-description { margin: 4px 0 0; min-height: 0; }
.appearance-swatches { margin: 7px 0 3px; }
}
+8 -4
View File
@@ -1,12 +1,16 @@
import { useSyncExternalStore } from 'react';
export type Palette = 'green' | 'blue';
export type Palette = 'green' | 'blue' | 'purple';
const storageKey = 'orven-palette';
const palettes = { green: { color: '#176b5b', icon: '/favicon.svg' }, blue: { color: '#4f6ef7', icon: '/brand/orven-icon-blue.svg' } };
const palettes = {
green: { color: '#176b5b', icon: '/favicon.svg' },
blue: { color: '#4f6ef7', icon: '/brand/orven-icon-blue.svg' },
purple: { color: '#6253b5', icon: '/brand/orven-icon-purple.svg' },
};
let snapshot: { palette: Palette; saved: boolean } = { palette: 'green', saved: true };
let initialized = false;
const listeners = new Set<() => void>();
const isPalette = (value: unknown): value is Palette => value === 'green' || value === 'blue';
const isPalette = (value: unknown): value is Palette => value === 'green' || value === 'blue' || value === 'purple';
function apply(palette: Palette, saved = true) {
document.documentElement.dataset.palette = palette;
@@ -27,7 +31,7 @@ export function initializeAppearance() {
if (initialized) return;
initialized = true;
let palette: Palette = 'green';
try { const stored = localStorage.getItem(storageKey); if (isPalette(stored)) palette = stored; } catch { /* The current page can still use either palette. */ }
try { const stored = localStorage.getItem(storageKey); if (isPalette(stored)) palette = stored; } catch { /* The current page can still switch palettes. */ }
const url = new URL(location.href), requested = url.searchParams.get('palette');
if (isPalette(requested)) {
choosePalette(requested);
+37
View File
@@ -74,3 +74,40 @@
--orven-toast-text: #eff3ff;
--orven-shadow-rgb: 28 46 78;
}
:root[data-palette="purple"] {
--orven-accent: #6253b5;
--orven-action: #6253b5;
--orven-accent-ink: #6253b5;
--orven-accent-hover: #51439c;
--orven-accent-soft: #efecf9;
--orven-ink: #37333f;
--orven-heading: #514b5c;
--orven-text: #57515f;
--orven-muted: #716979;
--orven-canvas: #f9f9fb;
--orven-workspace: #ffffff;
--orven-navigation: #f5f5f8;
--orven-surface: #f6f6f9;
--orven-surface-faint: #fcfbfe;
--orven-hover: #eeecf3;
--orven-selected: #e9e5f3;
--orven-selection: #e1dcf4;
--orven-line: #e4e4eb;
--orven-border: #e1dce9;
--orven-border-soft: #eeebf4;
--orven-border-strong: #d9d5e5;
--orven-border-hover: #c4bbdc;
--orven-scrollbar: #d0ced9;
--orven-focus-border: #ab94c7;
--orven-focus-ring: #ab94c715;
--orven-stream-border: #b8a9d5;
--orven-handle: #9a86b3;
--orven-unset: #aaa0b8;
--orven-icon-muted: #8d7c9e;
--orven-message: #f6f3fa;
--orven-message-border: #e8e2f1;
--orven-toast: #44334f;
--orven-toast-border: #65506f;
--orven-toast-text: #f3ecf7;
--orven-shadow-rgb: 48 35 74;
}