diff --git a/e2e/specs/mock/scenarios/clickhouse-theme-shape.spec.ts b/e2e/specs/mock/scenarios/clickhouse-theme-shape.spec.ts index df70b50bef..c2718b8148 100644 --- a/e2e/specs/mock/scenarios/clickhouse-theme-shape.spec.ts +++ b/e2e/specs/mock/scenarios/clickhouse-theme-shape.spec.ts @@ -109,6 +109,27 @@ test.describe('ClickHouse theme shape', () => { expect(await page.evaluate(() => localStorage.getItem('theme-definition'))).toBeNull(); }); + test('theme controls take Click UI control height, checked fill and focus outline @scenario:clickhouse-controls-follow-click-ui', async ({ + page, + }) => { + await storeClickHouse(page); + + await openMentionMenu(page); + await expect(page.locator('html')).toHaveAttribute('data-theme', 'clickhouse'); + const mode = await resolvedMode(page); + + /** `genericMenu.panel.size.height` and `transition.default`; the shared spacing role that + * also pads message bubbles keeps LibreChat's 12px. */ + expect(await probeStyle(page, 'h-theme-control', 'height')).toBe('32px'); + expect(await probeStyle(page, 'px-theme-normal', 'padding-left')).toBe('12px'); + expect(await probeStyle(page, 'duration-theme-fast', 'transition-duration')).toBe('0.1s'); + /** The checked checkbox and switch fill, and `outline.default`. */ + const fill = mode === 'light' ? 'rgb(21, 21, 21)' : 'rgb(250, 255, 105)'; + const ring = mode === 'light' ? 'rgb(67, 126, 239)' : 'rgb(250, 255, 105)'; + expect(await probeStyle(page, 'bg-surface-inverted', 'background-color')).toBe(fill); + expect(await probeStyle(page, 'ring-2 ring-ring-primary', 'box-shadow')).toContain(ring); + }); + test('monospace text under the ClickHouse theme leads with Inconsolata @scenario:clickhouse-mono-font-leads-with-inconsolata', async ({ page, }) => { diff --git a/packages/client/src/theme/themes/clickhouse.spec.tsx b/packages/client/src/theme/themes/clickhouse.spec.tsx index cfbce8060f..767a8bb926 100644 --- a/packages/client/src/theme/themes/clickhouse.spec.tsx +++ b/packages/client/src/theme/themes/clickhouse.spec.tsx @@ -357,12 +357,35 @@ describe('clickhouse theme definition', () => { 'shadowXl', 'shadow2xl', 'elevationSurface', + 'controlHeight', + 'motionFast', ] as const; expect( shapeTokens.filter((token) => clickHouse.appearance[token] === libreChat.appearance[token]), ).toEqual([]); }); + /** Click UI's control height and `transition.default`. The spacing roles keep LibreChat's + * values: they also pad message bubbles and the composer's send button, and 0.75rem is + * already Click UI's field padding. */ + it('sizes theme controls from Click UI and leaves the shared spacing alone', () => { + const { appearance } = resolveTheme(clickHouseTheme, 'light'); + expect(appearance).toMatchObject({ controlHeight: '2rem', motionFast: '100ms' }); + expect(appearance.spaceCompact).toBe(defaultAppearance.spaceCompact); + expect(appearance.spaceNormal).toBe(defaultAppearance.spaceNormal); + }); + + /** The checkbox, switch and default button share `surface-inverted`. Dark mode takes Click UI's + * primary fill, which its checkbox and switch also use; light keeps `#151515`, the checkbox and + * switch colour. Every focus ring takes `outline.default`. */ + it.each([ + ['light', clickHouseLightTheme, '21 21 21', '67 126 239'], + ['dark', clickHouseDarkTheme, '250 255 105', '250 255 105'], + ])('paints the %s primary fill and focus ring from Click UI', (_mode, theme, fill, ring) => { + expect(theme['rgb-surface-inverted']).toBe(fill); + expect(theme['rgb-ring-primary']).toBe(ring); + }); + it('keeps the brand yellow as the dark-mode accent and link', () => { expect(clickHouseDarkTheme['rgb-accent-primary']).toBe('250 255 105'); expect(clickHouseDarkTheme['rgb-surface-submit']).toBe('250 255 105'); diff --git a/packages/client/src/theme/themes/clickhouse.ts b/packages/client/src/theme/themes/clickhouse.ts index 9d7650a36c..28a21a9515 100644 --- a/packages/client/src/theme/themes/clickhouse.ts +++ b/packages/client/src/theme/themes/clickhouse.ts @@ -47,7 +47,7 @@ export const clickHouseLightTheme: IThemeRGB = { 'rgb-accent-primary-hover': '50 50 50', // #323232 (palette.neutral.712) // Ring colors - 'rgb-ring-primary': '21 21 21', // #151515 (accent.default) + 'rgb-ring-primary': '67 126 239', // #437eef (outline.default) // Header colors 'rgb-header-primary': '255 255 255', // #ffffff (background.default) @@ -70,7 +70,7 @@ export const clickHouseLightTheme: IThemeRGB = { 'rgb-surface-tertiary': '246 247 250', // #f6f7fa (background.muted) 'rgb-surface-tertiary-alt': '255 255 255', // #ffffff (background.default) 'rgb-surface-dialog': '255 255 255', // #ffffff (background.default) - 'rgb-surface-overlay': '83 87 95', // #53575f (palette.slate.700) + 'rgb-surface-overlay': '21 21 21', // #151515 (dialog.color.opaqueBackground, lch(6.7738 0 none)) 'rgb-surface-submit': '21 21 21', // #151515 (accent.default) 'rgb-surface-submit-hover': '50 50 50', // #323232 (palette.neutral.712) 'rgb-surface-destructive': '193 0 0', // #c10000 (palette.danger.600) @@ -198,9 +198,9 @@ export const clickHouseDarkTheme: IThemeRGB = { 'rgb-surface-chat': '31 31 28', // #1f1f1c (background.default) 'rgb-surface-code': '40 40 40', // #282828 (codeblock.darkMode.background.default) 'rgb-surface-code-body': '40 40 40', // #282828 (codeblock.darkMode.background.default) - 'rgb-surface-inverted': '255 255 255', // #ffffff (palette.neutral.0) - 'rgb-surface-inverted-hover': '223 223 223', // #dfdfdf (palette.neutral.200) - 'rgb-text-inverted': '21 21 21', // #151515 (palette.neutral.900) + 'rgb-surface-inverted': '250 255 105', // #faff69 (button.basic.color.primary.background.default) + 'rgb-surface-inverted-hover': '252 255 150', // #fcff96 (button.basic.color.primary.background.hover) + 'rgb-text-inverted': '31 31 28', // #1f1f1c (button.basic.color.primary.text.default) 'rgb-surface-fixed': '255 255 255', // #ffffff (palette.neutral.0, same in light and dark) 'rgb-surface-fixed-hover': '230 231 233', // #e6e7e9 (palette.slate.100, same in light and dark) 'rgb-text-fixed': '22 21 23', // #161517 (palette.slate.900, same in light and dark) @@ -302,6 +302,8 @@ const clickHouseShape = { '"Inconsolata", ui-monospace, SFMono-Regular, Menlo, "Cascadia Mono", "Liberation Mono", Consolas, monospace', shadowXs: '0 2px 2px 0 rgb(0 0 0 / 0.03)', // shadow.5 shadowSm: '0 2px 2px 0 rgb(0 0 0 / 0.03)', // shadow.5 + controlHeight: '2rem', // genericMenu.panel.size.height + motionFast: '100ms', // transition.default }; const elevation = (alpha: number): string =>