Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions apps/workbench/packages/e2e/test/composer-theme.spec.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import { tsImport } from 'tsx/esm/api';
import { launchBrowser } from '../harness.mjs';

const { PALETTES } = await tsImport('../../web/src/appearance.ts', import.meta.url);
const css = readFileSync(new URL('../../web/src/styles.css', import.meta.url), 'utf8');

// The scope is intentional: only Codex light changes. Unrelated themes retain
// their existing surface, filled queue rows and desktop/mobile material.
test('composer correction stays in Codex light across every shipped palette', async t => {
const browser = await launchBrowser();
const page = await browser.newPage();
try {
for (const { id } of PALETTES) for (const theme of ['light', 'dark']) for (const width of [1280, 390]) {
await t.test(`${id} ${theme} ${width}`, async () => {
await page.setViewportSize({ width, height: 844 });
await page.emulateMedia({ colorScheme: theme });
await page.setContent(`<html data-palette="${id}" data-theme="${theme}"><head><style>${css}</style></head><body>
<main class="main"><div class="composer"><div class="composer-box">
<div class="composer-context">Workspace</div>
<div class="queue"><div class="queue-item"><span class="queue-badge">Queued</span>Keep the queued message readable.</div></div>
<textarea aria-label="Draft"></textarea>
</div></div></main></body></html>`);
const actual = await page.evaluate(() => {
const style = selector => getComputedStyle(document.querySelector(selector));
const probe = document.createElement('div'); document.body.append(probe);
const token = (property, name) => {
probe.style.setProperty(property, `var(${name})`);
return getComputedStyle(probe).getPropertyValue(property);
};
const values = {
fill: style('.composer-box').backgroundColor, queue: style('.queue-item').backgroundColor,
context: style('.composer-context').backgroundColor, shadow: style('.composer-box').boxShadow,
blur: style('.composer-box').backdropFilter, queueBottom: style('.queue').paddingBottom,
canvas: token('background-color', '--bg'), surface: token('background-color', '--surface'),
row: token('background-color', '--surface-2'), glass: token('background-color', '--glass-bg'),
halo: token('box-shadow', '--glass-halo'), glassShadow: token('box-shadow', '--glass-shadow'),
glassFilter: token('backdrop-filter', '--glass-filter'),
};
probe.remove(); return values;
});
if (id === 'codex' && theme === 'light') {
assert.equal(actual.fill, actual.canvas);
assert.equal(actual.queue, 'rgba(0, 0, 0, 0)');
assert.equal(actual.context, 'rgba(0, 0, 0, 0)');
assert.equal(actual.shadow, 'none');
assert.equal(actual.blur, 'none');
assert.equal(actual.queueBottom, '8px');
} else {
assert.equal(actual.fill, width >= 900 ? actual.surface : actual.glass);
assert.equal(actual.queue, actual.row);
assert.equal(actual.context, actual.row);
assert.equal(actual.shadow, width >= 900 ? actual.halo : actual.glassShadow);
assert.equal(actual.blur, width >= 900 ? 'none' : actual.glassFilter);
assert.equal(actual.queueBottom, '0px');
}
});
}
} finally { await browser.close(); }
});
18 changes: 18 additions & 0 deletions apps/workbench/packages/web/src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,24 @@
--shadow-selected: inset 0 0 0 1px #a98d7f;
}

/* Only the Codex light composer shares its canvas. Other palettes and dark mode
retain their existing surface, queue fill and material. */
:root[data-palette='codex'][data-theme='light'] .composer-box {
background: var(--bg);
border-color: var(--border);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Codex 浅色边框覆盖附件拖放提示色。向真实 Composer 派发一个普通本地附件的 dragover,组件进入 drag-over 并显示松开提示。两档视口的虚线均保留,但基线的近黑提示边框 #0D0D0D 被浅色作用域覆盖为 #EBEBE9。桌面边框与输入背景的对比从约 18.6:1 降到 1.19:1,接收范围几乎融进白色画布。 让浅色背景规则保留普通状态的细边框,同时让拖放状态继续使用现有 --text 边框。可以限制默认边框选择器只匹配非拖放状态,或用低优先级作用域保留现有拖放优先级。补一条实际附件 dragover 的浅色视口回归测试。

box-shadow: none;
-webkit-backdrop-filter: none;
backdrop-filter: none;
}
:root[data-palette='codex'][data-theme='light'] .composer-context,
:root[data-palette='codex'][data-theme='light'] .queue-item {
background: transparent;
}
:root[data-palette='codex'][data-theme='light'] .queue {
padding-bottom: 8px;
border-bottom: 1px solid var(--border);
}

/* "claude" pins three tokens of its own, for the same reason: the hairline (#e4e4e4), the grey a
selected sidebar row wears (#e1e1e1) and the placeholder grey (#787878), each measured. */
[data-palette='claude']:not([data-palette='paper']) {
Expand Down
Loading