diff --git a/apps/workbench/packages/e2e/test/composer-theme.spec.mjs b/apps/workbench/packages/e2e/test/composer-theme.spec.mjs new file mode 100644 index 0000000000..793784c7aa --- /dev/null +++ b/apps/workbench/packages/e2e/test/composer-theme.spec.mjs @@ -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(` +
+
Workspace
+
QueuedKeep the queued message readable.
+ +
`); + 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(); } +}); diff --git a/apps/workbench/packages/web/src/styles.css b/apps/workbench/packages/web/src/styles.css index fd67ab3fa1..d1dcfee0ac 100644 --- a/apps/workbench/packages/web/src/styles.css +++ b/apps/workbench/packages/web/src/styles.css @@ -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); + 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']) {