Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

🪟 feat: Overlay Theme Roles for Tooltips, Error Alerts and Artifact Previews (#16739)

Marco Beretta27a6dc041dfc
diff --git a/client/src/components/Auth/LoginForm.tsx b/client/src/components/Auth/LoginForm.tsx
index d9682a1e16..ee4a0f93f7 100644
--- a/client/src/components/Auth/LoginForm.tsx
+++ b/client/src/components/Auth/LoginForm.tsx
@@ -37,7 +37,7 @@ const LoginForm: React.FC<TLoginFormProps> = ({ onSubmit, startupConfig, error,
? `${baseAutoComplete} webauthn`
: baseAutoComplete;
const authInputClassName =
- 'webkit-dark-styles peer h-auto w-full rounded-2xl border border-border-light bg-surface-primary px-3.5 pb-2.5 pt-3 text-text-primary duration-200 hover:border-border-light focus:border-accent-primary focus-visible:border-accent-primary';
+ 'webkit-dark-styles peer h-auto w-full rounded-2xl border border-border-light px-3.5 pb-2.5 pt-3 text-text-primary duration-200 hover:border-border-light focus:border-accent-primary focus-visible:border-accent-primary';
const authSecretInputClassName = `${authInputClassName} pr-12`;
const authLabelClassName =
'absolute start-3 top-1.5 z-10 origin-[0] -translate-y-4 scale-75 transform bg-surface-primary px-2 text-sm text-text-secondary-alt duration-200 peer-placeholder-shown:top-1/2 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:scale-100 peer-focus:top-1.5 peer-focus:-translate-y-4 peer-focus:scale-75 peer-focus:px-2 peer-focus:text-accent-primary rtl:peer-focus:left-auto rtl:peer-focus:translate-x-1/4';
diff --git a/client/src/components/Auth/Registration.tsx b/client/src/components/Auth/Registration.tsx
index 0f75bfd7e1..eb0d3e00f6 100644
--- a/client/src/components/Auth/Registration.tsx
+++ b/client/src/components/Auth/Registration.tsx
@@ -38,7 +38,7 @@ const Registration: React.FC = () => {
// only require captcha if we have a siteKey
const requireCaptcha = Boolean(startupConfig?.turnstile?.siteKey);
const authInputClassName =
- 'webkit-dark-styles peer h-auto w-full rounded-2xl border border-border-light bg-surface-primary px-3.5 pb-2.5 pt-3 text-text-primary duration-200 hover:border-border-light focus:border-accent-primary focus-visible:border-accent-primary';
+ 'webkit-dark-styles peer h-auto w-full rounded-2xl border border-border-light px-3.5 pb-2.5 pt-3 text-text-primary duration-200 hover:border-border-light focus:border-accent-primary focus-visible:border-accent-primary';
const authSecretInputClassName = `${authInputClassName} pr-12`;
const authLabelClassName =
'absolute start-3 top-1.5 z-10 origin-[0] -translate-y-4 scale-75 transform bg-surface-primary px-2 text-sm text-text-secondary-alt duration-200 peer-placeholder-shown:top-1/2 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:scale-100 peer-focus:top-1.5 peer-focus:-translate-y-4 peer-focus:scale-75 peer-focus:px-2 peer-focus:text-accent-primary rtl:peer-focus:left-auto rtl:peer-focus:translate-x-1/4';
diff --git a/client/src/components/Auth/RequestPasswordReset.tsx b/client/src/components/Auth/RequestPasswordReset.tsx
index 2fa0556028..760b62bc03 100644
--- a/client/src/components/Auth/RequestPasswordReset.tsx
+++ b/client/src/components/Auth/RequestPasswordReset.tsx
@@ -111,7 +111,7 @@ function RequestPasswordReset() {
},
})}
aria-invalid={!!errors.email}
- className="webkit-dark-styles peer border-border-light bg-surface-primary text-text-primary focus:border-accent-primary h-auto w-full rounded-2xl border px-3.5 pt-3 pb-2.5 duration-200"
+ className="webkit-dark-styles peer border-border-light text-text-primary focus:border-accent-primary h-auto w-full rounded-2xl border px-3.5 pt-3 pb-2.5 duration-200"
placeholder=" "
/>
<label
diff --git a/client/src/components/Auth/ResetPassword.tsx b/client/src/components/Auth/ResetPassword.tsx
index b4e4026518..d3bf379d60 100644
--- a/client/src/components/Auth/ResetPassword.tsx
+++ b/client/src/components/Auth/ResetPassword.tsx
@@ -21,7 +21,7 @@ function ResetPassword() {
const resetPassword = useResetPasswordMutation();
const { setError, setHeaderText, startupConfig } = useOutletContext<TLoginLayoutContext>();
const authInputClassName =
- 'webkit-dark-styles peer h-auto w-full rounded-2xl border border-border-light bg-surface-primary px-3.5 pb-2.5 pr-12 pt-3 text-text-primary duration-200 hover:border-border-light focus:border-accent-primary focus-visible:border-accent-primary';
+ 'webkit-dark-styles peer h-auto w-full rounded-2xl border border-border-light px-3.5 pb-2.5 pr-12 pt-3 text-text-primary duration-200 hover:border-border-light focus:border-accent-primary focus-visible:border-accent-primary';
const authLabelClassName =
'absolute start-3 top-1.5 z-10 origin-[0] -translate-y-4 scale-75 transform bg-surface-primary px-2 text-sm text-text-secondary-alt duration-200 peer-placeholder-shown:top-1/2 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:scale-100 peer-focus:top-1.5 peer-focus:-translate-y-4 peer-focus:scale-75 peer-focus:px-2 peer-focus:text-accent-primary rtl:peer-focus:left-auto rtl:peer-focus:translate-x-1/4';
const authSecretButtonClassName =
diff --git a/client/src/components/Chat/Input/Composer/Palette.tsx b/client/src/components/Chat/Input/Composer/Palette.tsx
index e326d134fd..1e95439d8a 100644
--- a/client/src/components/Chat/Input/Composer/Palette.tsx
+++ b/client/src/components/Chat/Input/Composer/Palette.tsx
@@ -1002,7 +1002,7 @@ function Palette({
)}
<span className="flex min-w-0 flex-1 flex-col justify-center">
<span className="truncate">{file.filename}</span>
- <span className="text-text-secondary truncate text-xs opacity-80">
+ <span className="text-text-secondary truncate text-xs">
{formatFileDate(file)}
</span>
</span>
@@ -1087,9 +1087,7 @@ function Palette({
{/* The dot is color only, so the status is still said aloud. */}
{status != null && <span className="sr-only">{status.label}</span>}
{description != null && description !== '' && (
- <span className="text-text-secondary truncate text-xs opacity-80">
- {description}
- </span>
+ <span className="text-text-secondary truncate text-xs">{description}</span>
)}
</span>
</button>
diff --git a/client/src/mobile.css b/client/src/mobile.css
index 7acf047f43..be3775f33d 100644
--- a/client/src/mobile.css
+++ b/client/src/mobile.css
@@ -137,6 +137,12 @@
/* Content elements */
.sp-preview-iframe {
@apply h-full w-full grow;
+ /* An unstyled artifact document inks in the browser's black over a transparent frame, which is
+ * unreadable on a dark theme. Canvas gives the frame an opaque page in the scheme the system
+ * prefers, and the document's own color-scheme decides whether it adapts to it or the browser
+ * paints it a light backdrop. */
+ color-scheme: light dark;
+ background-color: Canvas;
}
.sp-cm {
diff --git a/client/src/style.css b/client/src/style.css
index 33e51798e3..278d6db725 100644
--- a/client/src/style.css
+++ b/client/src/style.css
@@ -1709,14 +1709,14 @@ html {
.webkit-dark-styles,
.webkit-dark-styles:focus {
background-clip: content-box;
- -webkit-box-shadow: 0 0 0 50vh #fff inset;
+ -webkit-box-shadow: 0 0 0 50vh rgb(var(--field-fill, var(--surface-primary))) inset;
}
.dark .webkit-dark-styles,
.dark .webkit-dark-styles:focus {
- -webkit-text-fill-color: #fff;
+ -webkit-text-fill-color: rgb(var(--field-text, var(--text-primary)));
background-clip: content-box;
- -webkit-box-shadow: 0 0 0 50vh #0d0d0d inset;
+ -webkit-box-shadow: 0 0 0 50vh rgb(var(--field-fill, var(--surface-primary))) inset;
}
/* Ordered Listing */
@@ -1970,14 +1970,14 @@ html {
z-index: 150;
cursor: pointer;
border-radius: var(--theme-tooltip-radius, 0.275rem);
- background-color: rgb(var(--surface-primary));
- padding-top: 0.25rem;
- padding-bottom: 0.25rem;
- padding-left: 0.5rem;
- padding-right: 0.5rem;
- font-size: 1rem;
- line-height: 1.5rem;
- color: rgb(var(--text-primary));
+ background-color: rgb(var(--surface-tooltip, var(--surface-primary)));
+ padding-top: var(--theme-tooltip-padding-y, 0.25rem);
+ padding-bottom: var(--theme-tooltip-padding-y, 0.25rem);
+ padding-left: var(--theme-tooltip-padding-x, 0.5rem);
+ padding-right: var(--theme-tooltip-padding-x, 0.5rem);
+ font-size: var(--theme-tooltip-text-size, 1rem);
+ line-height: 1.5;
+ color: rgb(var(--text-tooltip, var(--text-primary)));
box-shadow: var(--theme-tooltip-shadow, 0 2px 4px 0 rgb(0 0 0 / 0.25));
}
diff --git a/e2e/specs/mock/scenarios/theme-tooltip.spec.ts b/e2e/specs/mock/scenarios/theme-tooltip.spec.ts
new file mode 100644
index 0000000000..8d85bc0f65
--- /dev/null
+++ b/e2e/specs/mock/scenarios/theme-tooltip.spec.ts
@@ -0,0 +1,93 @@
+import { expect, test } from '@playwright/test';
+import type { Page } from '@playwright/test';
+import { clickHouseTheme } from '../../../../packages/client/src/theme/themes/clickhouse';
+import { NEW_CHAT_PATH } from '../helpers';
+
+/**
+ * The tooltip reads its chip, label, padding and text size from theme roles. Click UI draws a dark
+ * chip with a white 12px label in 8px 12px padding in both modes; LibreChat's own tooltip is the
+ * page surface with the page ink, 16px text and 4px 8px padding, and stays that way without a theme.
+ */
+test.describe.configure({ timeout: 120_000 });
+test.use({ viewport: { width: 1280, height: 800 } });
+
+type Mode = 'light' | 'dark';
+
+type ThemeChoice = 'clickhouse' | 'default';
+
+/**
+ * One init script per page: Playwright does not order several, so the theme and mode a
+ * navigation wants ride in its URL and the script stores or clears the definition.
+ */
+async function installThemeBridge(page: Page) {
+ await page.addInitScript((definition) => {
+ const params = new URL(location.href).searchParams;
+ const theme = params.get('e2eTheme');
+ const mode = params.get('e2eThemeMode');
+ if (theme === null || mode === null) {
+ return;
+ }
+ localStorage.setItem('color-theme', mode);
+ localStorage.removeItem('theme-colors');
+ localStorage.removeItem('theme-name');
+ if (theme === 'clickhouse') {
+ localStorage.setItem('theme-definition', JSON.stringify(definition));
+ localStorage.setItem('theme-source', 'definition');
+ } else {
+ localStorage.removeItem('theme-definition');
+ localStorage.removeItem('theme-source');
+ }
+ }, clickHouseTheme);
+}
+
+const rgb = (triplet: string | undefined) => `rgb(${(triplet ?? '').split(' ').join(', ')})`;
+
+async function openTooltip(page: Page, theme: ThemeChoice, mode: Mode) {
+ await page.goto(`${NEW_CHAT_PATH}?e2eTheme=${theme}&e2eThemeMode=${mode}`, { timeout: 15000 });
+ await page.getByTestId('new-chat-button').hover();
+ const tooltip = page.locator('.tooltip');
+ await expect(tooltip).toBeVisible({ timeout: 10000 });
+ return tooltip.evaluate((node: HTMLElement) => {
+ const style = getComputedStyle(node);
+ return {
+ background: style.backgroundColor,
+ color: style.color,
+ padding: [style.paddingTop, style.paddingRight],
+ fontSize: style.fontSize,
+ };
+ });
+}
+
+test.describe('theme tooltip', () => {
+ test('the tooltip takes the Click UI chip under the ClickHouse theme @scenario:clickhouse-tooltip-follows-click-ui', async ({
+ page,
+ }) => {
+ await installThemeBridge(page);
+ for (const mode of ['light', 'dark'] as Mode[]) {
+ const colors = clickHouseTheme.modes[mode]?.colors;
+ expect(await openTooltip(page, 'clickhouse', mode)).toEqual({
+ background: rgb(colors?.['rgb-surface-tooltip']),
+ color: rgb(colors?.['rgb-text-tooltip']),
+ padding: ['8px', '12px'],
+ fontSize: '12px',
+ });
+ }
+ });
+
+ test('the default theme keeps its tooltip @scenario:default-theme-tooltip-unchanged', async ({
+ page,
+ }) => {
+ await installThemeBridge(page);
+ for (const [mode, background, color] of [
+ ['light', 'rgb(255, 255, 255)', 'rgb(33, 33, 33)'],
+ ['dark', 'rgb(13, 13, 13)', 'rgb(236, 236, 236)'],
+ ] as Array<[Mode, string, string]>) {
+ expect(await openTooltip(page, 'default', mode)).toEqual({
+ background,
+ color,
+ padding: ['4px', '8px'],
+ fontSize: '16px',
+ });
+ }
+ });
+});
diff --git a/eslint-suppressions.json b/eslint-suppressions.json
index fd4666cb83..b289ba5b38 100644
--- a/eslint-suppressions.json
+++ b/eslint-suppressions.json
@@ -88,22 +88,22 @@
},
"client/src/components/Auth/LoginForm.tsx": {
"shadcn/no-restyle": {
- "count": 39
+ "count": 37
}
},
"client/src/components/Auth/Registration.tsx": {
"shadcn/no-restyle": {
- "count": 39
+ "count": 37
}
},
"client/src/components/Auth/RequestPasswordReset.tsx": {
"shadcn/no-restyle": {
- "count": 15
+ "count": 14
}
},
"client/src/components/Auth/ResetPassword.tsx": {
"shadcn/no-restyle": {
- "count": 54
+ "count": 52
}
},
"client/src/components/Auth/TwoFactorScreen.tsx": {
diff --git a/packages/client/src/components/Alert.tsx b/packages/client/src/components/Alert.tsx
index 2ed1e73ec8..d10fbba1ac 100644
--- a/packages/client/src/components/Alert.tsx
+++ b/packages/client/src/components/Alert.tsx
@@ -17,7 +17,7 @@ const alertVariants: (
info: 'border-status-info-border bg-status-info-subtle text-status-info',
success: 'border-status-success-border bg-status-success-subtle text-status-success',
warning: 'border-status-warning-border bg-status-warning-subtle text-status-warning',
- error: 'border-status-error-border bg-status-error-subtle text-status-error',
+ error: 'border-alert-error-border bg-alert-error-fill text-status-error',
neutral: 'border-status-neutral-border bg-status-neutral-subtle text-status-neutral',
},
/** `raised` lifts a notice off the surface it sits on with the lightest shadow. */
diff --git a/packages/client/src/components/Tooltip.css b/packages/client/src/components/Tooltip.css
index d8db905f24..e66a27400c 100644
--- a/packages/client/src/components/Tooltip.css
+++ b/packages/client/src/components/Tooltip.css
@@ -3,14 +3,14 @@
cursor: pointer;
pointer-events: auto;
border-radius: var(--theme-tooltip-radius, 0.275rem);
- background-color: rgb(var(--surface-primary));
- padding-top: 0.25rem;
- padding-bottom: 0.25rem;
- padding-left: 0.5rem;
- padding-right: 0.5rem;
- font-size: 1rem;
- line-height: 1.5rem;
- color: rgb(var(--text-primary));
+ background-color: rgb(var(--surface-tooltip, var(--surface-primary)));
+ padding-top: var(--theme-tooltip-padding-y, 0.25rem);
+ padding-bottom: var(--theme-tooltip-padding-y, 0.25rem);
+ padding-left: var(--theme-tooltip-padding-x, 0.5rem);
+ padding-right: var(--theme-tooltip-padding-x, 0.5rem);
+ font-size: var(--theme-tooltip-text-size, 1rem);
+ line-height: 1.5;
+ color: rgb(var(--text-tooltip, var(--text-primary)));
box-shadow: var(--theme-tooltip-shadow, 0 2px 4px 0 rgb(0 0 0 / 0.25));
/* Enhanced layout for longer descriptions */
max-width: 320px;
diff --git a/packages/client/src/theme/README.md b/packages/client/src/theme/README.md
index 3b75b84f7f..cc2aa8b55f 100644
--- a/packages/client/src/theme/README.md
+++ b/packages/client/src/theme/README.md
@@ -381,6 +381,12 @@ Each status family has a foreground, a `-subtle` background, a `-border`, and a
names those and not these. Fields stay clear unless the theme's
`fieldFillStyle` appearance role is `fill` (the default is `transparent`),
read from the nearest themed root through the `theme-field-fill:` variant.
+- `bg-surface-tooltip` / `text-tooltip` - The tooltip chip and its label. They follow
+ `surface-primary` and `text-primary` when a theme names those and not these. The padding and
+ text size are the `tooltipPaddingX`, `tooltipPaddingY` and `tooltipTextSize` appearance roles
+ (0.5rem, 0.25rem and 1rem by default).
+- `bg-alert-error-fill` / `border-alert-error-border` - The error `Alert`'s fill and edge. They
+ follow `status-error-subtle` and `status-error-border`, which the badges, tags and diffs keep.
- `border-border-field-focus` - A form field's edge while it holds focus, under
`fieldFocusStyle: border`. Follows `focus-control` when a theme names only that.
- Form fields and labels - `h-theme-field` (`fieldHeight`) sizes `Input`, `Dropdown`
diff --git a/packages/client/src/theme/defaults.css b/packages/client/src/theme/defaults.css
index a6482e4083..00544ddc38 100644
--- a/packages/client/src/theme/defaults.css
+++ b/packages/client/src/theme/defaults.css
@@ -158,6 +158,10 @@ html {
--border-field-focus: var(--focus-control);
--field-fill: var(--surface-primary);
--field-text: var(--text-primary);
+ --surface-tooltip: var(--surface-primary);
+ --text-tooltip: var(--text-primary);
+ --alert-error-fill: var(--status-error-subtle);
+ --alert-error-border: var(--status-error-border);
--focus-control: var(--gray-800);
--border-disabled: var(--gray-200);
--status-success: var(--green-700);
@@ -219,6 +223,9 @@ html {
--theme-large-surface-radius: 1.5rem;
--theme-menu-radius: 0.7rem;
--theme-tooltip-radius: 0.275rem;
+ --theme-tooltip-padding-x: 0.5rem;
+ --theme-tooltip-padding-y: 0.25rem;
+ --theme-tooltip-text-size: 1rem;
--theme-tab-radius: 0.185rem;
--theme-tab-min-width: 100px;
--theme-list-min-width: 8rem;
@@ -405,6 +412,10 @@ html {
--border-field-focus: var(--focus-control);
--field-fill: var(--surface-primary);
--field-text: var(--text-primary);
+ --surface-tooltip: var(--surface-primary);
+ --text-tooltip: var(--text-primary);
+ --alert-error-fill: var(--status-error-subtle);
+ --alert-error-border: var(--status-error-border);
--focus-control: var(--gray-100);
--border-disabled: var(--gray-650);
--status-success: var(--green-300);
diff --git a/packages/client/src/theme/defaults.spec.ts b/packages/client/src/theme/defaults.spec.ts
index 5362e9d346..fd3e28be3a 100644
--- a/packages/client/src/theme/defaults.spec.ts
+++ b/packages/client/src/theme/defaults.spec.ts
@@ -68,7 +68,7 @@ describe.each([
const tokens = Object.keys(theme) as Array<keyof IThemeRGB>;
it('covers every registry color', () => {
- expect(tokens).toHaveLength(131);
+ expect(tokens).toHaveLength(135);
});
it('resolves every registry color to the runtime theme value', () => {
diff --git a/packages/client/src/theme/registry.spec.ts b/packages/client/src/theme/registry.spec.ts
index 65c15cefea..c0f9afb4ec 100644
--- a/packages/client/src/theme/registry.spec.ts
+++ b/packages/client/src/theme/registry.spec.ts
@@ -486,6 +486,51 @@ describe('theme registry', () => {
expect(untouched.colors['rgb-switch-thumb']).toBe(darkTheme['rgb-switch-thumb']);
});
+ it('keeps the tooltip and the error alert on the roles a theme repainted before they existed', () => {
+ const resolved = resolveTheme(
+ {
+ version: 1,
+ name: 'legacy-overlays',
+ modes: {
+ light: {
+ colors: {
+ 'rgb-surface-primary': '20 21 22',
+ 'rgb-text-primary': '1 2 3',
+ 'rgb-status-error-subtle': '4 5 6',
+ 'rgb-status-error-border': '7 8 9',
+ },
+ },
+ },
+ },
+ 'light',
+ );
+
+ expect(resolved.colors['rgb-surface-tooltip']).toBe('20 21 22');
+ expect(resolved.colors['rgb-text-tooltip']).toBe('1 2 3');
+ expect(resolved.colors['rgb-alert-error-fill']).toBe('4 5 6');
+ expect(resolved.colors['rgb-alert-error-border']).toBe('7 8 9');
+ });
+
+ it('preserves an explicit tooltip surface and falls back to the bundled one otherwise', () => {
+ const explicit = resolveTheme(
+ {
+ version: 1,
+ name: 'explicit-tooltip',
+ modes: {
+ dark: { colors: { 'rgb-surface-primary': '20 21 22', 'rgb-surface-tooltip': '1 2 3' } },
+ },
+ },
+ 'dark',
+ );
+ const untouched = resolveTheme(
+ { version: 1, name: 'no-surface', modes: { dark: { colors: {} } } },
+ 'dark',
+ );
+
+ expect(explicit.colors['rgb-surface-tooltip']).toBe('1 2 3');
+ expect(untouched.colors['rgb-surface-tooltip']).toBe(darkTheme['rgb-surface-tooltip']);
+ });
+
it('keeps a self-sticking table header on the dialog surface a theme repainted', () => {
const legacy = resolveTheme(
{
diff --git a/packages/client/src/theme/registry.ts b/packages/client/src/theme/registry.ts
index c19704d9b3..e36bcaabe5 100644
--- a/packages/client/src/theme/registry.ts
+++ b/packages/client/src/theme/registry.ts
@@ -138,6 +138,25 @@ export function primaryInkFallbacks(colors: IThemeRGB): IThemeRGB {
);
}
+/** Roles that were painted in another role before they had their own. */
+export const overlayFallbackSources: ReadonlyArray<readonly [keyof IThemeRGB, keyof IThemeRGB]> = [
+ ['rgb-surface-tooltip', 'rgb-surface-primary'],
+ ['rgb-text-tooltip', 'rgb-text-primary'],
+ ['rgb-alert-error-fill', 'rgb-status-error-subtle'],
+ ['rgb-alert-error-border', 'rgb-status-error-border'],
+];
+
+/** A theme that repaints a source role keeps the tooltip and the error alert on it, unless it
+ * names them. */
+export function overlayFallbacks(colors: IThemeRGB): IThemeRGB {
+ return Object.fromEntries(
+ overlayFallbackSources.flatMap(([role, source]) => {
+ const value = colors[source];
+ return colors[role] === undefined && value !== undefined ? [[role, value]] : [];
+ }),
+ );
+}
+
/**
* The focus roles for a stored or environment theme that predates them. The
* global outline followed a theme's `rgb-ring-primary` whenever it named one,
@@ -165,6 +184,9 @@ export const themeAppearanceProperties: Readonly<
largeSurfaceRadius: '--theme-large-surface-radius',
menuRadius: '--theme-menu-radius',
tooltipRadius: '--theme-tooltip-radius',
+ tooltipPaddingX: '--theme-tooltip-padding-x',
+ tooltipPaddingY: '--theme-tooltip-padding-y',
+ tooltipTextSize: '--theme-tooltip-text-size',
tabRadius: '--theme-tab-radius',
tabMinWidth: '--theme-tab-min-width',
listMinWidth: '--theme-list-min-width',
@@ -253,6 +275,9 @@ export const defaultAppearance: IThemeAppearance = Object.freeze({
largeSurfaceRadius: '1.5rem',
menuRadius: '0.7rem',
tooltipRadius: '0.275rem',
+ tooltipPaddingX: '0.5rem',
+ tooltipPaddingY: '0.25rem',
+ tooltipTextSize: '1rem',
tabRadius: '0.185rem',
tabMinWidth: '100px',
listMinWidth: '8rem',
@@ -668,6 +693,7 @@ export function resolveTheme(theme: ThemeDefinition, mode: ThemeMode): ResolvedT
const primaryButtonFallback: IThemeRGB =
customColors != null ? primaryButtonFallbacks(customColors) : {};
const primaryInks: IThemeRGB = customColors != null ? primaryInkFallbacks(customColors) : {};
+ const overlayFallback: IThemeRGB = customColors != null ? overlayFallbacks(customColors) : {};
/**
* Slot 8 arrived after the seven-slot scale shipped, so a stored or
* environment theme that paints its own scale cannot name it. Filling the
@@ -732,6 +758,7 @@ export function resolveTheme(theme: ThemeDefinition, mode: ThemeMode): ResolvedT
...chartWidgetStrokeFallback,
...switchThumbFallback,
...fieldFillFallback,
+ ...overlayFallback,
...tableHeaderTextFallback,
...tableHeaderFillFallback,
...borderControlFallback,
diff --git a/packages/client/src/theme/semanticTokens.spec.ts b/packages/client/src/theme/semanticTokens.spec.ts
index 2ef08f54fd..58b9183eff 100644
--- a/packages/client/src/theme/semanticTokens.spec.ts
+++ b/packages/client/src/theme/semanticTokens.spec.ts
@@ -258,6 +258,13 @@ describe.each([
);
});
+ it('keeps the tooltip label and the error alert text at WCAG AA', () => {
+ const tooltip = belowAA(theme, ['rgb-text-tooltip'], ['rgb-surface-tooltip']);
+ const alert = belowAA(theme, ['rgb-status-error'], ['rgb-alert-error-fill']);
+
+ expect({ tooltip, alert }).toEqual({ tooltip: [], alert: [] });
+ });
+
it('keeps warning and destructive text at WCAG AA on canvas surfaces', () => {
expect(belowAA(theme, statusTextTokens, canvasSurfaces)).toEqual([]);
});
diff --git a/packages/client/src/theme/themes/clickhouse.ts b/packages/client/src/theme/themes/clickhouse.ts
index 8b6d3669dc..88f2ad4bc2 100644
--- a/packages/client/src/theme/themes/clickhouse.ts
+++ b/packages/client/src/theme/themes/clickhouse.ts
@@ -112,6 +112,10 @@ export const clickHouseLightTheme: IThemeRGB = {
'rgb-border-field-focus': '22 21 23', // #161517 (field.color.stroke.active)
'rgb-field-fill': '251 252 255', // #fbfcff (field.color.background.default)
'rgb-field-text': '48 46 50', // #302e32 (field.color.text.default)
+ 'rgb-surface-tooltip': '29 29 29', // #1d1d1d (tooltip.color.background.default, lch(10.767 0 0 / 0.85) taken opaque)
+ 'rgb-text-tooltip': '255 255 255', // #ffffff (tooltip.color.label.default)
+ 'rgb-alert-error-fill': '255 233 233', // #ffe9e9 (alert.color.background.danger, danger at 10% over background.default)
+ 'rgb-alert-error-border': '255 233 233', // #ffe9e9 (Click UI alerts draw no edge, so it matches the fill)
'rgb-surface-disabled': '223 223 223', // #dfdfdf (button.basic.color.primary.background.disabled)
'rgb-text-disabled': '160 160 160', // #a0a0a0 (text.disabled)
'rgb-border-disabled': '223 223 223', // #dfdfdf (field.color.stroke.disabled)
@@ -148,7 +152,7 @@ export const clickHouseLightTheme: IThemeRGB = {
'rgb-illustration-subtle': '161 190 247', // #a1bef7 (palette.info.200)
'rgb-illustration': '67 126 239', // #437eef (palette.info.400)
'rgb-illustration-strong': '16 78 198', // #104ec6 (palette.info.600)
- 'rgb-file-document': '204 0 153', // #cc0099 (palette.fuchsia.600)
+ 'rgb-file-document': '13 62 155', // #0d3e9b (palette.info.700)
'rgb-file-sheet': '0 138 11', // #008a0b (palette.success.700)
'rgb-file-code': '214 79 0', // #d64f00 (palette.warning.600)
'rgb-file-artifact': '48 46 50', // #302e32 (palette.slate.800)
@@ -274,6 +278,10 @@ export const clickHouseDarkTheme: IThemeRGB = {
'rgb-border-field-focus': '250 255 105', // #faff69 (field.color.stroke.active)
'rgb-field-fill': '45 45 45', // rgb(17.794% 17.794% 17.794%) (field.color.background.default)
'rgb-field-text': '230 231 233', // #e6e7e9 (field.color.text.default)
+ 'rgb-surface-tooltip': '50 50 50', // #323232 (palette.neutral.712; tooltip.color.background.default #282828 would vanish on the #282828 canvas)
+ 'rgb-text-tooltip': '255 255 255', // #ffffff (tooltip.color.label.default)
+ 'rgb-alert-error-fill': '76 32 29', // #4c201d (alert.color.background.danger, danger at 20% over background.default)
+ 'rgb-alert-error-border': '76 32 29', // #4c201d (Click UI alerts draw no edge, so it matches the fill)
'rgb-surface-disabled': '65 65 65', // #414141 (button.basic.color.primary.background.disabled)
'rgb-text-disabled': '128 128 128', // #808080 (text.disabled)
'rgb-border-disabled': '65 65 65', // #414141 (field.color.stroke.disabled)
@@ -310,7 +318,7 @@ export const clickHouseDarkTheme: IThemeRGB = {
'rgb-illustration-subtle': '161 190 247', // #a1bef7 (palette.info.200)
'rgb-illustration': '67 126 239', // #437eef (palette.info.400)
'rgb-illustration-strong': '16 78 198', // #104ec6 (palette.info.600)
- 'rgb-file-document': '204 0 153', // #cc0099 (palette.fuchsia.600)
+ 'rgb-file-document': '67 126 239', // #437eef (palette.info.400)
'rgb-file-sheet': '0 138 11', // #008a0b (palette.success.700)
'rgb-file-code': '214 79 0', // #d64f00 (palette.warning.600)
'rgb-file-artifact': '48 46 50', // #302e32 (palette.slate.800)
@@ -383,6 +391,9 @@ const clickHouseShape = {
roundControlRadius: '9999px',
menuRadius: '0.25rem', // genericMenu.panel.radii.all
tooltipRadius: '0.25rem', // tooltip.radii.all
+ tooltipPaddingX: '0.75rem', // tooltip.space.x
+ tooltipPaddingY: '0.5rem', // tooltip.space.y
+ tooltipTextSize: '0.75rem', // tooltip.typography.label.default
tabRadius: '0.25rem', // tabs.radii.all
/** Click UI sizes a tab trigger by its label, in `tabs.space.x` on each side. */
tabMinWidth: '0',
diff --git a/packages/client/src/theme/themes/clickui.json b/packages/client/src/theme/themes/clickui.json
index f74de25a2d..f4ae894a76 100644
--- a/packages/client/src/theme/themes/clickui.json
+++ b/packages/client/src/theme/themes/clickui.json
@@ -11,6 +11,7 @@
"border.radii.2": "0.5rem",
"border.radii.3": "0.75rem",
"border.radii.full": "9999px",
+ "click.alert.color.background.danger": "rgb(100% 13.725% 13.725% / 0.1)",
"click.avatar.color.background.default": "#696e79",
"click.avatar.color.text.default": "#ffffff",
"click.badge.opaque.color.background.default": "#f6f7fa",
@@ -72,7 +73,12 @@
"click.table.radii.all": "0.25rem",
"click.table.row.color.stroke.default": "#e6e7e9",
"click.tabs.radii.all": "0.25rem",
+ "click.tooltip.color.background.default": "lch(10.767 0 none / 0.85)",
+ "click.tooltip.color.label.default": "#ffffff",
"click.tooltip.radii.all": "0.25rem",
+ "click.tooltip.space.x": "0.75rem",
+ "click.tooltip.space.y": "0.5rem",
+ "click.tooltip.typography.label.default": "400 0.75rem/1.5 \"Inter\", \"SF Pro Display\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen, Ubuntu, Cantarell, \"Open Sans\", \"Helvetica Neue\", sans-serif",
"global.color.accent.default": "#151515",
"global.color.background.default": "#ffffff",
"global.color.background.muted": "#f6f7fa",
@@ -108,12 +114,12 @@
"palette.danger.200": "#ff9898",
"palette.danger.600": "#c10000",
"palette.danger.700": "#910000",
- "palette.fuchsia.600": "#cc0099",
"palette.fuchsia.700": "#990073",
"palette.info.200": "#a1bef7",
"palette.info.400": "#437eef",
"palette.info.500": "#1d64ec",
"palette.info.600": "#104ec6",
+ "palette.info.700": "#0d3e9b",
"palette.neutral.0": "#ffffff",
"palette.neutral.712": "#323232",
"palette.neutral.900": "#151515",
@@ -162,6 +168,7 @@
"border.radii.2": "0.5rem",
"border.radii.3": "0.75rem",
"border.radii.full": "9999px",
+ "click.alert.color.background.danger": "rgb(100% 13.725% 13.725% / 0.2)",
"click.avatar.color.background.default": "#808691",
"click.avatar.color.text.default": "#1f1f1c",
"click.badge.opaque.color.background.default": "#1f1f1c",
@@ -223,7 +230,12 @@
"click.table.radii.all": "0.25rem",
"click.table.row.color.stroke.default": "#323232",
"click.tabs.radii.all": "0.25rem",
+ "click.tooltip.color.background.default": "lch(16.114 0 none / 0.95)",
+ "click.tooltip.color.label.default": "#ffffff",
"click.tooltip.radii.all": "0.25rem",
+ "click.tooltip.space.x": "0.75rem",
+ "click.tooltip.space.y": "0.5rem",
+ "click.tooltip.typography.label.default": "400 0.75rem/1.5 \"Inter\", \"SF Pro Display\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen, Ubuntu, Cantarell, \"Open Sans\", \"Helvetica Neue\", sans-serif",
"global.color.accent.default": "#faff69",
"global.color.background.default": "#1f1f1c",
"global.color.background.muted": "#282828",
@@ -260,7 +272,6 @@
"palette.danger.200": "#ff9898",
"palette.danger.300": "#ff7575",
"palette.danger.700": "#910000",
- "palette.fuchsia.600": "#cc0099",
"palette.info.200": "#a1bef7",
"palette.info.300": "#6d9bf3",
"palette.info.400": "#437eef",
diff --git a/packages/client/src/theme/themes/clickui.spec.ts b/packages/client/src/theme/themes/clickui.spec.ts
index 0e9f62dfed..634b3f78fc 100644
--- a/packages/client/src/theme/themes/clickui.spec.ts
+++ b/packages/client/src/theme/themes/clickui.spec.ts
@@ -156,7 +156,7 @@ const colorSources: Record<ThemeMode, Partial<Record<keyof IThemeRGB, string>>>
'rgb-illustration-subtle': 'palette.info.200',
'rgb-illustration': 'palette.info.400',
'rgb-illustration-strong': 'palette.info.600',
- 'rgb-file-document': 'palette.fuchsia.600',
+ 'rgb-file-document': 'palette.info.700',
'rgb-file-sheet': 'palette.success.700',
'rgb-file-code': 'palette.warning.600',
'rgb-file-artifact': 'palette.slate.800',
@@ -185,6 +185,8 @@ const colorSources: Record<ThemeMode, Partial<Record<keyof IThemeRGB, string>>>
'rgb-table-header-text': 'click.table.header.color.title.default',
'rgb-table-header-fill': 'click.table.header.color.background.default',
'rgb-presentation': 'global.color.background.default',
+ 'rgb-surface-tooltip': 'click.tooltip.color.background.default',
+ 'rgb-text-tooltip': 'click.tooltip.color.label.default',
},
dark: {
'rgb-text-primary': 'global.color.text.default',
@@ -286,7 +288,7 @@ const colorSources: Record<ThemeMode, Partial<Record<keyof IThemeRGB, string>>>
'rgb-illustration-subtle': 'palette.info.200',
'rgb-illustration': 'palette.info.400',
'rgb-illustration-strong': 'palette.info.600',
- 'rgb-file-document': 'palette.fuchsia.600',
+ 'rgb-file-document': 'palette.info.400',
'rgb-file-sheet': 'palette.success.700',
'rgb-file-code': 'palette.warning.600',
'rgb-file-artifact': 'palette.slate.800',
@@ -315,6 +317,8 @@ const colorSources: Record<ThemeMode, Partial<Record<keyof IThemeRGB, string>>>
'rgb-table-header-text': 'click.table.header.color.title.default',
'rgb-table-header-fill': 'click.table.header.color.background.default',
'rgb-presentation': 'global.color.background.default',
+ 'rgb-surface-tooltip': 'palette.neutral.712',
+ 'rgb-text-tooltip': 'click.tooltip.color.label.default',
},
};
@@ -326,17 +330,24 @@ const AVATAR_EDGE_REASON =
const MEDIA_SCRIM_DEPARTURE =
'the dialog scrim is the nearest Click UI job; a lightbox frames the user image in black instead';
+const ALERT_ALPHA_REASON =
+ 'Click UI draws the danger alert as feedback.danger at 10% (light) or 20% (dark) alpha with no edge; a role holds an opaque triplet, so the theme takes the fill blended over the page and the edge equals it';
+
/** Values the theme sets on purpose without a Click UI source, and why. */
const unsourcedColors: Record<ThemeMode, Partial<Record<keyof IThemeRGB, string>>> = {
light: {
'rgb-surface-media-overlay': MEDIA_OVERLAY_REASON,
'rgb-avatar-edge': AVATAR_EDGE_REASON,
+ 'rgb-alert-error-fill': ALERT_ALPHA_REASON,
+ 'rgb-alert-error-border': ALERT_ALPHA_REASON,
},
dark: {
'rgb-surface-overlay':
'Click UI dark dialog.color.opaqueBackground is a gray that leaves the dialog under 3:1',
'rgb-surface-media-overlay': MEDIA_OVERLAY_REASON,
'rgb-avatar-edge': AVATAR_EDGE_REASON,
+ 'rgb-alert-error-fill': ALERT_ALPHA_REASON,
+ 'rgb-alert-error-border': ALERT_ALPHA_REASON,
},
};
@@ -360,6 +371,16 @@ interface Departure {
*/
const departures: Record<ThemeMode, Partial<Record<keyof IThemeRGB, Departure>>> = {
light: {
+ 'rgb-alert-error-fill': {
+ counterpart: 'click.alert.color.background.danger',
+ status: 'mismatch',
+ reason: ALERT_ALPHA_REASON,
+ },
+ 'rgb-alert-error-border': {
+ counterpart: 'click.alert.color.background.danger',
+ status: 'mismatch',
+ reason: ALERT_ALPHA_REASON,
+ },
'rgb-avatar-edge': {
counterpart: 'global.color.stroke.default',
status: 'near',
@@ -467,6 +488,22 @@ const departures: Record<ThemeMode, Partial<Record<keyof IThemeRGB, Departure>>>
status: 'mismatch',
reason: MEDIA_SCRIM_DEPARTURE,
},
+ 'rgb-alert-error-fill': {
+ counterpart: 'click.alert.color.background.danger',
+ status: 'mismatch',
+ reason: ALERT_ALPHA_REASON,
+ },
+ 'rgb-alert-error-border': {
+ counterpart: 'click.alert.color.background.danger',
+ status: 'mismatch',
+ reason: ALERT_ALPHA_REASON,
+ },
+ 'rgb-surface-tooltip': {
+ counterpart: 'click.tooltip.color.background.default',
+ status: 'near',
+ reason:
+ 'tooltip.color.background.default is the #282828 canvas in dark, which hides the chip; one step up the neutral ramp keeps white 4.5:1 and lifts it off the page',
+ },
'rgb-avatar-edge': {
counterpart: 'global.color.stroke.default',
status: 'mismatch',
@@ -600,6 +637,9 @@ const appearanceSources: Partial<Record<keyof IThemeAppearance, string>> = {
spaceNormal: 'spaces.3',
menuRadius: 'click.genericMenu.panel.radii.all',
tooltipRadius: 'click.tooltip.radii.all',
+ tooltipPaddingX: 'click.tooltip.space.x',
+ tooltipPaddingY: 'click.tooltip.space.y',
+ tooltipTextSize: 'click.tooltip.typography.label.default',
tabRadius: 'click.tabs.radii.all',
fontFamily: 'typography.font.families.regular',
monoFontFamily: 'typography.font.families.mono',
@@ -836,6 +876,7 @@ const fontShorthandParts: Partial<
labelFontWeight: 'weight',
labelSize: 'size',
labelLeading: 'leading',
+ tooltipTextSize: 'size',
};
function comparable(key: keyof IThemeAppearance, raw: string | number): string {
diff --git a/packages/client/src/theme/themes/dark.ts b/packages/client/src/theme/themes/dark.ts
index bdacfb157d..8a3c63732b 100644
--- a/packages/client/src/theme/themes/dark.ts
+++ b/packages/client/src/theme/themes/dark.ts
@@ -86,6 +86,10 @@ export const darkTheme: IThemeRGB = {
'rgb-border-field-focus': '236 236 236', // #ececec (gray-100, matching focus-control)
'rgb-field-fill': '13 13 13', // #0d0d0d (gray-900, matching surface-primary)
'rgb-field-text': '236 236 236', // #ececec (gray-100, matching text-primary)
+ 'rgb-surface-tooltip': '13 13 13', // matching surface-primary
+ 'rgb-text-tooltip': '236 236 236', // matching text-primary
+ 'rgb-alert-error-fill': '69 10 10', // matching status-error-subtle
+ 'rgb-alert-error-border': '153 27 27', // matching status-error-border
'rgb-surface-disabled': '47 47 47', // #2f2f2f (gray-700)
'rgb-text-disabled': '153 150 150', // #999696 (gray-400)
'rgb-border-disabled': '57 57 57', // #393939 (gray-650)
diff --git a/packages/client/src/theme/themes/default.ts b/packages/client/src/theme/themes/default.ts
index c43a32c860..4677dd64dc 100644
--- a/packages/client/src/theme/themes/default.ts
+++ b/packages/client/src/theme/themes/default.ts
@@ -86,6 +86,10 @@ export const defaultTheme: IThemeRGB = {
'rgb-border-field-focus': '33 33 33', // #212121 (gray-800, matching focus-control)
'rgb-field-fill': '255 255 255', // #fff (white, matching surface-primary)
'rgb-field-text': '33 33 33', // #212121 (gray-800, matching text-primary)
+ 'rgb-surface-tooltip': '255 255 255', // matching surface-primary
+ 'rgb-text-tooltip': '33 33 33', // matching text-primary
+ 'rgb-alert-error-fill': '254 242 242', // matching status-error-subtle
+ 'rgb-alert-error-border': '252 165 165', // matching status-error-border
'rgb-surface-disabled': '236 236 236', // #ececec (gray-100)
'rgb-text-disabled': '153 150 150', // #999696 (gray-400)
'rgb-border-disabled': '227 227 227', // #e3e3e3 (gray-200)
diff --git a/packages/client/src/theme/themes/highContrast.ts b/packages/client/src/theme/themes/highContrast.ts
index 34a515dff5..24ccd47b5b 100644
--- a/packages/client/src/theme/themes/highContrast.ts
+++ b/packages/client/src/theme/themes/highContrast.ts
@@ -122,6 +122,10 @@ export const highContrastLightTheme: IThemeRGB = {
'rgb-border-field-focus': '0 0 0', // #000000 (matching focus-control)
'rgb-field-fill': '255 255 255', // #ffffff (matching surface-primary)
'rgb-field-text': '0 0 0', // #000000 (matching text-primary)
+ 'rgb-surface-tooltip': '255 255 255', // matching surface-primary
+ 'rgb-text-tooltip': '0 0 0', // matching text-primary
+ 'rgb-alert-error-fill': '255 255 255', // matching status-error-subtle
+ 'rgb-alert-error-border': '161 0 0', // matching status-error-border
'rgb-surface-disabled': '255 255 255', // #ffffff
'rgb-text-disabled': '87 87 87', // #575757
'rgb-border-disabled': '87 87 87', // #575757
@@ -302,6 +306,10 @@ export const highContrastDarkTheme: IThemeRGB = {
'rgb-border-field-focus': '255 255 255', // #ffffff (matching focus-control)
'rgb-field-fill': '0 0 0', // #000000 (matching surface-primary)
'rgb-field-text': '255 255 255', // #ffffff (matching text-primary)
+ 'rgb-surface-tooltip': '0 0 0', // matching surface-primary
+ 'rgb-text-tooltip': '255 255 255', // matching text-primary
+ 'rgb-alert-error-fill': '0 0 0', // matching status-error-subtle
+ 'rgb-alert-error-border': '255 143 143', // matching status-error-border
'rgb-surface-disabled': '0 0 0', // #000000
'rgb-text-disabled': '184 184 184', // #b8b8b8
'rgb-border-disabled': '184 184 184', // #b8b8b8
diff --git a/packages/client/src/theme/tokens.css b/packages/client/src/theme/tokens.css
index 0ee78369e1..b738a3fe78 100644
--- a/packages/client/src/theme/tokens.css
+++ b/packages/client/src/theme/tokens.css
@@ -124,6 +124,12 @@
/* Follow the canvas and the primary ink, for a stylesheet that predates them. */
--color-field-fill: rgb(var(--field-fill, var(--surface-primary)));
--color-field-text: rgb(var(--field-text, var(--text-primary)));
+ /* Follow the roles they were painted in before they had their own, for a stylesheet that
+ predates them. */
+ --color-surface-tooltip: rgb(var(--surface-tooltip, var(--surface-primary)));
+ --color-text-tooltip: rgb(var(--text-tooltip, var(--text-primary)));
+ --color-alert-error-fill: rgb(var(--alert-error-fill, var(--status-error-subtle)));
+ --color-alert-error-border: rgb(var(--alert-error-border, var(--status-error-border)));
--color-border-disabled: rgb(var(--border-disabled));
/* status */
diff --git a/packages/client/src/theme/types/index.ts b/packages/client/src/theme/types/index.ts
index c114097b76..7daa673cd0 100644
--- a/packages/client/src/theme/types/index.ts
+++ b/packages/client/src/theme/types/index.ts
@@ -111,6 +111,14 @@ export interface IThemeRGB {
'rgb-field-fill'?: string;
/** A field's typed value; follows `rgb-text-primary` when a theme omits it. */
'rgb-field-text'?: string;
+ /** A tooltip's chip and its label; they follow `rgb-surface-primary` and `rgb-text-primary` when a
+ * theme omits them. */
+ 'rgb-surface-tooltip'?: string;
+ 'rgb-text-tooltip'?: string;
+ /** The error alert's fill and edge; they follow `rgb-status-error-subtle` and
+ * `rgb-status-error-border` when a theme omits them. */
+ 'rgb-alert-error-fill'?: string;
+ 'rgb-alert-error-border'?: string;
/** Disabled fill, ink and edge. Painted only under the `fill` disabled style. */
'rgb-surface-disabled'?: string;
'rgb-text-disabled'?: string;
@@ -300,6 +308,10 @@ export interface IThemeVariables {
'--border-field-focus': string;
'--field-fill': string;
'--field-text': string;
+ '--surface-tooltip': string;
+ '--text-tooltip': string;
+ '--alert-error-fill': string;
+ '--alert-error-border': string;
'--surface-disabled': string;
'--text-disabled': string;
'--border-disabled': string;
@@ -439,6 +451,10 @@ export interface IThemeColors {
'border-field-focus'?: string;
'field-fill'?: string;
'field-text'?: string;
+ 'surface-tooltip'?: string;
+ 'text-tooltip'?: string;
+ 'alert-error-fill'?: string;
+ 'alert-error-border'?: string;
'surface-disabled'?: string;
'text-disabled'?: string;
'border-disabled'?: string;
@@ -517,6 +533,11 @@ export interface IThemeAppearance {
* control and surface radii; their defaults are the literals those primitives drew. */
menuRadius: string;
tooltipRadius: string;
+ /** A tooltip's padding and the size of its text, apart from the control spacing and the type
+ * scale; their defaults are the literals the tooltip drew. */
+ tooltipPaddingX: string;
+ tooltipPaddingY: string;
+ tooltipTextSize: string;
tabRadius: string;
/** The narrowest a tab trigger draws; `0` sizes it by its label. */
tabMinWidth: string;
diff --git a/packages/client/src/theme/utils/applyTheme.spec.ts b/packages/client/src/theme/utils/applyTheme.spec.ts
index c487739a81..93c95f9dfc 100644
--- a/packages/client/src/theme/utils/applyTheme.spec.ts
+++ b/packages/client/src/theme/utils/applyTheme.spec.ts
@@ -21,6 +21,8 @@ const semanticProperties = [
'--chart-widget-surface',
'--chart-widget-stroke',
'--switch-thumb',
+ '--surface-tooltip',
+ '--alert-error-fill',
'--avatar-placeholder',
'--avatar-text',
'--table-header-text',
@@ -521,6 +523,23 @@ describe('applyTheme', () => {
expect(root.style.getPropertyValue('--switch-thumb')).toBe('1 2 3');
});
+ it('keeps the tooltip and the error alert of a legacy theme on the roles it repainted', () => {
+ const root = document.documentElement;
+
+ applyTheme({ 'rgb-surface-primary': '20 21 22', 'rgb-status-error-subtle': '4 5 6' }, root);
+
+ expect(root.style.getPropertyValue('--surface-tooltip')).toBe('20 21 22');
+ expect(root.style.getPropertyValue('--alert-error-fill')).toBe('4 5 6');
+ });
+
+ it('leaves an explicit tooltip surface alone', () => {
+ const root = document.documentElement;
+
+ applyTheme({ 'rgb-surface-primary': '20 21 22', 'rgb-surface-tooltip': '1 2 3' }, root);
+
+ expect(root.style.getPropertyValue('--surface-tooltip')).toBe('1 2 3');
+ });
+
it('keeps table column names of a legacy theme on its secondary text', () => {
const root = document.documentElement;
diff --git a/packages/client/src/theme/utils/applyTheme.ts b/packages/client/src/theme/utils/applyTheme.ts
index 981d0136bf..4803fb2d27 100644
--- a/packages/client/src/theme/utils/applyTheme.ts
+++ b/packages/client/src/theme/utils/applyTheme.ts
@@ -2,6 +2,7 @@ import type { IThemeAppearance, IThemeBrands, IThemeRGB, ResolvedThemeDefinition
import {
controlBorderFallback,
focusFallbacks,
+ overlayFallbacks,
pressedFallbacks,
primaryButtonFallbacks,
primaryInkFallbacks,
@@ -82,6 +83,10 @@ function mapColors(colors: IThemeRGB, base?: IThemeRGB): Array<[string, string]>
variables.push(['--field-fill', colors['rgb-surface-primary']]);
}
+ Object.entries(overlayFallbacks(colors)).forEach(([role, value]) => {
+ variables.push([colorProperty(role as keyof IThemeRGB), value]);
+ });
+
if (colors['rgb-table-header-text'] === undefined && colors['rgb-text-secondary'] !== undefined) {
variables.push(['--table-header-text', colors['rgb-text-secondary']]);
}
diff --git a/packages/data-provider/src/theme.ts b/packages/data-provider/src/theme.ts
index 5ee8e9605f..ffd9f35dc9 100644
--- a/packages/data-provider/src/theme.ts
+++ b/packages/data-provider/src/theme.ts
@@ -84,6 +84,10 @@ export const themeColorTokens = Object.freeze([
'rgb-border-field-focus',
'rgb-field-fill',
'rgb-field-text',
+ 'rgb-surface-tooltip',
+ 'rgb-text-tooltip',
+ 'rgb-alert-error-fill',
+ 'rgb-alert-error-border',
'rgb-surface-disabled',
'rgb-text-disabled',
'rgb-border-disabled',
@@ -359,6 +363,10 @@ const appearanceValidators = {
/** A menu panel's, a tooltip's and a tab trigger's corner. */
menuRadius: isLength,
tooltipRadius: isLength,
+ /** A tooltip's padding and text size. */
+ tooltipPaddingX: isLength,
+ tooltipPaddingY: isLength,
+ tooltipTextSize: isLength,
tabRadius: isLength,
tabMinWidth: isTableLength,
/** A Select list's narrowest width (`0` to size it by its trigger), and the height it scrolls