Skip to content
TypeScript

fix(web): chip palette test follows the single design (#26131)

Julius Marminge5808469018fb
diff --git a/apps/web/src/themePalette.browser.test.ts b/apps/web/src/themePalette.browser.test.ts
index 51136eb7af5..4204b069780 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 4aaa6062b74..3a20981bd3f 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<ThemeAppearance, Partial<ThemeColors>> = {
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(