From 180dd310db89d6130d042117e04f251c8e27634b Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 27 Oct 2026 13:43:09 -0700 Subject: [PATCH] fix(web): chip palette test follows the single design #25066 was tested on a base before #25778 removed the design toggle, so its legacy-dark arm expected the old #0a0a0a canvas that index.css no longer paints. Drop the dead redesign flag from getStandardPaintedThemeColors. Co-Authored-By: Claude Opus 5.5 --- apps/web/src/themePalette.browser.test.ts | 39 ++++++++++------------- apps/web/src/themePalette.ts | 16 +++------- 2 files changed, 21 insertions(+), 34 deletions(-) diff --git a/apps/web/src/themePalette.browser.test.ts b/apps/web/src/themePalette.browser.test.ts index 51136eb7af5cc..4204b069780c9 100644 --- a/apps/web/src/themePalette.browser.test.ts +++ b/apps/web/src/themePalette.browser.test.ts @@ -25,31 +25,26 @@ describe("standard painted theme colors", () => { it("match the chip surfaces index.css paints", () => { const root = document.documentElement; try { - for (const redesign of [false, true, false]) { - root.toggleAttribute("data-redesign", redesign); - for (const appearance of ["light", "dark"] as const) { - root.classList.toggle("dark", appearance === "dark"); - const colors = getStandardPaintedThemeColors(appearance, redesign); - const canvas = paintedChannels("--background"); - for (const [variable, role] of [ - ["--background", "canvas"], - ["--card", "surface"], - ["--surface-raised", "surfaceRaised"], - ["--message-surface", "messageSurface"], - ] as const) { - const expected = toRgb(colors[role])!; - const painted = paintedChannels(variable, canvas); - [expected.r, expected.g, expected.b].forEach((channel, index) => { - expect( - Math.abs(channel * 255 - painted[index]!), - `${appearance} ${role}`, - ).toBeLessThan(1.5); - }); - } + for (const appearance of ["light", "dark"] as const) { + root.classList.toggle("dark", appearance === "dark"); + const colors = getStandardPaintedThemeColors(appearance); + const canvas = paintedChannels("--background"); + for (const [variable, role] of [ + ["--background", "canvas"], + ["--card", "surface"], + ["--surface-raised", "surfaceRaised"], + ["--message-surface", "messageSurface"], + ] as const) { + const expected = toRgb(colors[role])!; + const painted = paintedChannels(variable, canvas); + [expected.r, expected.g, expected.b].forEach((channel, index) => { + expect(Math.abs(channel * 255 - painted[index]!), `${appearance} ${role}`).toBeLessThan( + 1.5, + ); + }); } } } finally { - root.removeAttribute("data-redesign"); root.classList.remove("dark"); } }); diff --git a/apps/web/src/themePalette.ts b/apps/web/src/themePalette.ts index 4aaa6062b7481..3a20981bd3f3d 100644 --- a/apps/web/src/themePalette.ts +++ b/apps/web/src/themePalette.ts @@ -403,19 +403,12 @@ export function getStandardThemeColors(appearance: ThemeAppearance): ThemeColors // index.css paints the light bubble a step darker than the shared palette mobile uses. const STANDARD_WEB_PAINTED_COLORS: Record> = { light: { messageSurface: "#ebebed" }, - dark: {}, + dark: { canvas: "#000000", messageSurface: "#1e1e1e" }, }; /** The standard theme as index.css paints it, for solves that measure the page. */ -export function getStandardPaintedThemeColors( - appearance: ThemeAppearance, - redesign = false, -): ThemeColors { - return { - ...getStandardThemeColors(appearance), - ...STANDARD_WEB_PAINTED_COLORS[appearance], - ...(redesign && appearance === "dark" ? { canvas: "#000000", messageSurface: "#1e1e1e" } : {}), - }; +export function getStandardPaintedThemeColors(appearance: ThemeAppearance): ThemeColors { + return { ...getStandardThemeColors(appearance), ...STANDARD_WEB_PAINTED_COLORS[appearance] }; } type ThemeRgbColor = { @@ -1636,8 +1629,7 @@ export function applyThemePalette(theme: ThemePreference, appearance?: ThemeAppe for (const variable of Object.values(APP_THEME_VARIABLES)) { root.style.removeProperty(variable); } - // The redesign's lighter dark bubble is the stricter surface, so this ink also covers legacy UI. - applyContextChipVariables(root, getStandardPaintedThemeColors(appearance ?? "light", true)); + applyContextChipVariables(root, getStandardPaintedThemeColors(appearance ?? "light")); } export function resolveThemeAppearance(