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

💠 fix: Paint Native Tool Verification Badges (#15862)

Marco Beretta246e7e5de783
diff --git a/client/src/components/SidePanel/Agents/Tools/ToolCard.tsx b/client/src/components/SidePanel/Agents/Tools/ToolCard.tsx
index d3faf7541a..d3cd5e0f7e 100644
--- a/client/src/components/SidePanel/Agents/Tools/ToolCard.tsx
+++ b/client/src/components/SidePanel/Agents/Tools/ToolCard.tsx
@@ -1,5 +1,6 @@
import { memo, useState } from 'react';
-import { BadgeCheck, Check, Globe, Info, Settings, Star, User } from 'lucide-react';
+import { VerifiedIcon } from '@librechat/client';
+import { Check, Globe, Info, Settings, Star, User } from 'lucide-react';
import type { TranslationKeys } from '~/hooks/useLocalize';
import type { AgentItem } from './items/types';
import { hasConfigurableSettings } from './items/configurable';
@@ -128,9 +129,8 @@ function ToolCardImpl({
<p className="flex min-w-0 flex-1 items-center gap-1 text-sm font-semibold text-text-primary">
<span className="truncate">{name}</span>
{isNative && (
- <BadgeCheck
- className="size-4 shrink-0 fill-status-success-strong text-text-on-status"
- strokeWidth={2}
+ <VerifiedIcon
+ className="size-3.5 shrink-0 text-status-verified"
aria-label={localize('com_ui_tools_native')}
/>
)}
diff --git a/client/src/components/SidePanel/Agents/Tools/__tests__/ToolsMarketplaceDialog.spec.tsx b/client/src/components/SidePanel/Agents/Tools/__tests__/ToolsMarketplaceDialog.spec.tsx
index 47c0c9cd90..f087867f11 100644
--- a/client/src/components/SidePanel/Agents/Tools/__tests__/ToolsMarketplaceDialog.spec.tsx
+++ b/client/src/components/SidePanel/Agents/Tools/__tests__/ToolsMarketplaceDialog.spec.tsx
@@ -1,5 +1,6 @@
import '@testing-library/jest-dom/extend-expect';
import { fireEvent, render, screen } from '@testing-library/react';
+import type { SVGProps } from 'react';
import ToolsMarketplaceDialog from '../ToolsMarketplaceDialog';
const mockSetValue = jest.fn();
@@ -145,6 +146,7 @@ jest.mock('@librechat/client', () => {
asChild
? React.createElement(React.Fragment, null, children)
: React.createElement('button', { type: 'button' }, children),
+ VerifiedIcon: (props: SVGProps<SVGSVGElement>) => React.createElement('svg', props),
useToastContext: () => ({ showToast: jest.fn() }),
};
});
diff --git a/client/src/style.css b/client/src/style.css
index 0acb2f2e59..5dea3d61d0 100644
--- a/client/src/style.css
+++ b/client/src/style.css
@@ -219,6 +219,7 @@ html {
--status-neutral: var(--gray-600);
--status-neutral-subtle: var(--gray-100);
--status-neutral-border: var(--gray-300);
+ --status-verified: 37 99 235;
--text-on-status: var(--white);
/* Categorical series scale — slot order is the CVD-safety mechanism */
@@ -338,6 +339,7 @@ html {
--status-neutral: var(--gray-300);
--status-neutral-subtle: var(--gray-800);
--status-neutral-border: var(--gray-700);
+ --status-verified: 26 127 216;
--text-on-status: var(--white);
/* Categorical series scale — same hues, stepped for the dark surface */
diff --git a/e2e/lighthouse/audit.ts b/e2e/lighthouse/audit.ts
index 6c3d0f6958..3bf8ad25fb 100644
--- a/e2e/lighthouse/audit.ts
+++ b/e2e/lighthouse/audit.ts
@@ -15,6 +15,9 @@ const REPORTS_DIRECTORY = '.lighthouse';
const DEFAULT_RUNS = 3;
+/** Attempts per run before a crashed Lighthouse process fails the audit. */
+const RUN_ATTEMPTS = 2;
+
const DEFAULT_BUDGETS: MedianBudgets = {
'largest-contentful-paint': 4500,
'cumulative-layout-shift': 0.1,
@@ -79,10 +82,33 @@ export async function auditPage({
try {
for (let run = 1; run <= runs; run++) {
const output = path.join(directory, `lhr-${run}`);
- const { stdout } = await exec(process.execPath, [cli, ...flags, `--output-path=${output}`]);
- console.log(`Lighthouse run ${run}/${runs} wrote ${output}.report.json`);
- if (stdout.trim()) {
- console.log(stdout);
+ for (let attempt = 1; ; attempt++) {
+ try {
+ const { stdout } = await exec(process.execPath, [
+ cli,
+ ...flags,
+ `--output-path=${output}`,
+ ]);
+ console.log(`Lighthouse run ${run}/${runs} wrote ${output}.report.json`);
+ if (stdout.trim()) {
+ console.log(stdout);
+ }
+ break;
+ } catch (error) {
+ if (attempt >= RUN_ATTEMPTS) {
+ throw error;
+ }
+ /** Lighthouse crashes out of a run it could not trace — NO_NAVSTART is
+ * the usual one, and its own message is "run Lighthouse again". The
+ * page is measured `runs` times for exactly this noise, so one lost
+ * process should cost a repeat, not the lane. A page that is really
+ * broken fails every attempt and still fails here. */
+ console.log(
+ `Lighthouse run ${run}/${runs} attempt ${attempt} did not complete, retrying: ${
+ error instanceof Error ? error.message.split('\n')[0] : String(error)
+ }`,
+ );
+ }
}
}
} finally {
diff --git a/e2e/specs/mock/agents.helpers.ts b/e2e/specs/mock/agents.helpers.ts
index 191945730d..79445ebbfd 100644
--- a/e2e/specs/mock/agents.helpers.ts
+++ b/e2e/specs/mock/agents.helpers.ts
@@ -5,6 +5,15 @@ import { MOCK_ENDPOINTS, NEW_CHAT_PATH, fetchJson, getAccessToken, requestJson }
export const AGENT_EDIT_PERMISSION = 2;
+/** The app switches layouts on `(max-width: 768px)` — inclusive, so 768 itself
+ * is the sidebar-switcher layout, not the rail. */
+const NARROW_MAX_WIDTH = 768;
+/** Playwright reports no viewport only for a full-page context, which the mock
+ * projects never use; treat that as the desktop layout. */
+const DESKTOP_WIDTH = 1280;
+/** `MOBILE_DRAWER_ID` in `client/src/components/UnifiedSidebar/constants.ts`. */
+const MOBILE_DRAWER_ID = 'mobile-drawer';
+
export type AgentSummary = {
_id: string;
id: string;
@@ -86,15 +95,41 @@ export async function openAgentBuilder(page: Page) {
await page.goto(NEW_CHAT_PATH, { timeout: 10000 });
const form = page.getByRole('form', { name: 'Agent configuration form' });
+ /** Which control exists is a layout decision, not a timing one: the rail is
+ * desktop-only, and at or below the app's own `(max-width: 768px)` the same
+ * panels live in the sidebar's switcher menu. Probing the page for one would
+ * turn a slow first paint into the wrong branch. */
+ const narrow = (page.viewportSize()?.width ?? DESKTOP_WIDTH) <= NARROW_MAX_WIDTH;
+
+ if (narrow) {
+ /** The drawer stays mounted while closed — translated off-canvas and marked
+ * `inert` — and Playwright calls a translated element visible, so both the
+ * switcher and a restored builder form pass a visibility check while they
+ * sit behind an inert drawer. `inert` is the state, and the drawer element
+ * is where the app writes it (`UnifiedSidebar.tsx`), so the drawer is
+ * opened before anything inside it is read or handed back. */
+ const drawer = page.locator(`#${MOBILE_DRAWER_ID}`);
+ await expect(drawer).toBeAttached();
+ if (await drawer.evaluate((element) => element.hasAttribute('inert'))) {
+ await page.getByRole('button', { name: 'Open sidebar' }).click();
+ await expect(drawer).not.toHaveAttribute('inert', /.*/);
+ }
+ }
+
const builderVisible = await form
.waitFor({ state: 'visible', timeout: 1000 })
.then(() => true)
.catch(() => false);
if (!builderVisible) {
- const agentBuilderButton = page.getByRole('button', { name: 'Agent Builder' });
- await expect(agentBuilderButton).toBeVisible();
- if ((await agentBuilderButton.getAttribute('aria-pressed')) !== 'true') {
- await agentBuilderButton.click();
+ if (narrow) {
+ await page.getByTestId('panel-switcher-button').click();
+ await page.getByRole('menuitemcheckbox', { name: 'Agent Builder' }).click();
+ } else {
+ const agentBuilderButton = page.getByRole('button', { name: 'Agent Builder' });
+ await expect(agentBuilderButton).toBeVisible();
+ if ((await agentBuilderButton.getAttribute('aria-pressed')) !== 'true') {
+ await agentBuilderButton.click();
+ }
}
}
await expect(form).toBeVisible();
diff --git a/e2e/specs/mock/scenarios/verified-tool-mark.spec.ts b/e2e/specs/mock/scenarios/verified-tool-mark.spec.ts
new file mode 100644
index 0000000000..3a60c4d54e
--- /dev/null
+++ b/e2e/specs/mock/scenarios/verified-tool-mark.spec.ts
@@ -0,0 +1,217 @@
+import { devices, expect, test } from '@playwright/test';
+import type { Locator, Page } from '@playwright/test';
+import { openAgentBuilder } from '../agents.helpers';
+import { NEW_CHAT_PATH, fetchJson, getAccessToken } from '../helpers';
+
+const MCP_SERVER_NAME = 'e2e-memory';
+const MCP_TOOL_ID = `remember_fact_mcp_${MCP_SERVER_NAME}`;
+/** WCAG 1.4.11: a graphical object owes 3:1 against what it sits on. */
+const MARK_FLOOR = 3;
+
+type MCPToolsResponse = {
+ servers?: Record<string, { tools?: Array<{ pluginKey: string }> }>;
+};
+
+type Paint = { color: string; badgeStroke: string; checkStroke: string };
+
+function channels(cssColor: string): [number, number, number] {
+ const match = cssColor.match(/rgba?\(([^)]+)\)/);
+ expect(match, `expected an rgb color, received ${cssColor}`).not.toBeNull();
+ const parts = match![1].split(',').map((part) => Number.parseFloat(part.trim()));
+ return [parts[0], parts[1], parts[2]];
+}
+
+function relativeLuminance(cssColor: string): number {
+ const [r, g, b] = channels(cssColor).map((channel) => {
+ const ratio = channel / 255;
+ return ratio <= 0.03928 ? ratio / 12.92 : ((ratio + 0.055) / 1.055) ** 2.4;
+ });
+ return 0.2126 * r + 0.7152 * g + 0.0722 * b;
+}
+
+function contrast(a: string, b: string): number {
+ const [high, low] = [relativeLuminance(a), relativeLuminance(b)].sort((x, y) => y - x);
+ return (high + 0.05) / (low + 0.05);
+}
+
+async function openToolLibrary(page: Page): Promise<Locator> {
+ const form = await openAgentBuilder(page);
+ await form.getByRole('button', { name: 'Add tools' }).click();
+ const dialog = page.getByRole('dialog', { name: 'Tool Library' });
+ await expect(dialog).toBeVisible();
+ return dialog;
+}
+
+function verifiedMark(dialog: Locator): Locator {
+ return dialog.locator('svg[aria-label="Native"]').first();
+}
+
+/** The badge is the first path and the check the second, so a stroke leaking
+ * onto the badge is visible here as a color instead of `none`. */
+async function paintOf(mark: Locator): Promise<Paint> {
+ return mark.evaluate((element) => {
+ const [badge, check] = Array.from(element.children) as SVGElement[];
+ return {
+ color: getComputedStyle(element).color,
+ badgeStroke: getComputedStyle(badge).stroke,
+ checkStroke: getComputedStyle(check).stroke,
+ };
+ });
+}
+
+/** The wrapper carries the card's background; the button inside stays
+ * transparent, so the wrapper is what repaints on hover. */
+const CARD_FROM_MARK = 'xpath=ancestor::button[1]/..';
+
+async function useTheme(page: Page, theme: 'light' | 'dark', colors?: Record<string, string>) {
+ await page.addInitScript(
+ ([selected, legacyColors]: [string, string | null]) => {
+ localStorage.setItem('color-theme', selected);
+ localStorage.removeItem('theme-definition');
+ localStorage.removeItem('theme-source');
+ if (legacyColors === null) {
+ localStorage.removeItem('theme-colors');
+ localStorage.removeItem('theme-name');
+ return;
+ }
+ localStorage.setItem('theme-colors', legacyColors);
+ localStorage.setItem('theme-name', 'e2e-legacy');
+ },
+ [theme, colors ? JSON.stringify(colors) : null] as [string, string | null],
+ );
+}
+
+test.describe('native tool verified mark', () => {
+ test('@scenario:native-tool-card-shows-verified-mark a native tool wears a painted mark beside its name', async ({
+ page,
+ }) => {
+ test.setTimeout(120000);
+ const dialog = await openToolLibrary(page);
+ const mark = verifiedMark(dialog);
+ await expect(mark).toBeVisible();
+
+ const paint = await paintOf(mark);
+ expect(paint.badgeStroke).toBe('none');
+ expect(channels(paint.color)).not.toEqual(channels(paint.checkStroke));
+ expect(contrast(paint.color, paint.checkStroke)).toBeGreaterThanOrEqual(MARK_FLOOR);
+
+ const card = mark.locator(CARD_FROM_MARK);
+ const resting = await card.evaluate((element) => getComputedStyle(element).backgroundColor);
+ /** A resting card is transparent, so what sits behind the mark is the panel. */
+ const behind = resting.endsWith(', 0)')
+ ? await dialog.evaluate((element) => getComputedStyle(element).backgroundColor)
+ : resting;
+ expect(contrast(paint.color, behind)).toBeGreaterThanOrEqual(MARK_FLOOR);
+ });
+
+ test('@scenario:verified-mark-holds-silhouette-on-dark-hover hovering a native card in dark mode keeps the mark legible', async ({
+ page,
+ }) => {
+ test.setTimeout(120000);
+ await useTheme(page, 'dark');
+
+ const dialog = await openToolLibrary(page);
+ await expect(page.locator('html')).toHaveClass(/(^|\s)dark(\s|$)/);
+
+ const mark = verifiedMark(dialog);
+ await expect(mark).toBeVisible();
+ const card = mark.locator(CARD_FROM_MARK);
+
+ const panel = await dialog.evaluate((element) => getComputedStyle(element).backgroundColor);
+ /** A touch viewport has no hover state to lose, so there the card keeps its
+ * resting background and that is what the mark has to survive. */
+ const hoverable = await page.evaluate(() => matchMedia('(hover: hover)').matches);
+ if (hoverable) {
+ await card.hover();
+ }
+ const painted = await card.evaluate((element) => getComputedStyle(element).backgroundColor);
+ /** A resting card is transparent, so what sits behind the mark is the panel. */
+ const background = painted.endsWith(', 0)') ? panel : painted;
+ if (hoverable) {
+ /** The repaint has to have happened, or the assertion below would measure
+ * the resting card and pass for the wrong reason. */
+ expect(background).not.toBe(panel);
+ }
+
+ const paint = await paintOf(mark);
+ expect(paint.badgeStroke).toBe('none');
+ expect(contrast(paint.color, background)).toBeGreaterThanOrEqual(MARK_FLOOR);
+ expect(contrast(paint.color, paint.checkStroke)).toBeGreaterThanOrEqual(MARK_FLOOR);
+ });
+
+ test('@scenario:legacy-custom-theme-keeps-verified-mark-on-its-palette a theme that predates the token paints the mark with its own success fill', async ({
+ page,
+ }) => {
+ test.setTimeout(120000);
+ /** A deployment palette from before `status-verified` existed: it names the
+ * fill the mark used to wear and nothing about the mark itself. */
+ await useTheme(page, 'light', {
+ 'rgb-status-success-strong': '124 45 18',
+ 'rgb-text-on-status': '255 255 255',
+ });
+
+ const dialog = await openToolLibrary(page);
+ const mark = verifiedMark(dialog);
+ await expect(mark).toBeVisible();
+ await expect(mark).toHaveCSS('color', 'rgb(124, 45, 18)');
+ });
+
+ test('@scenario:mcp-server-card-shows-no-verified-mark a third-party server carries no mark', async ({
+ page,
+ }) => {
+ test.setTimeout(120000);
+ /** The token is minted from the page session, so the app has to be loaded
+ * before the request has an origin to resolve against. */
+ await page.goto(NEW_CHAT_PATH, { timeout: 10000 });
+ const token = await getAccessToken(page);
+ await expect
+ .poll(
+ async () => {
+ const tools = await fetchJson<MCPToolsResponse>(page, '/api/mcp/tools', token);
+ return (tools.servers?.[MCP_SERVER_NAME]?.tools ?? []).some(
+ (tool) => tool.pluginKey === MCP_TOOL_ID,
+ );
+ },
+ { timeout: 60000 },
+ )
+ .toBe(true);
+
+ const dialog = await openToolLibrary(page);
+ await dialog.getByRole('textbox', { name: 'Search tools…' }).fill(MCP_SERVER_NAME);
+
+ const serverCard = dialog.getByRole('button', { name: new RegExp(MCP_SERVER_NAME) }).first();
+ await expect(serverCard).toBeVisible();
+ await expect(serverCard.locator('svg[aria-label="Native"]')).toHaveCount(0);
+ });
+});
+
+/** The mock project is Desktop Chrome, so the touch layout — the sidebar
+ * switcher that replaces the rail, and a card that never receives hover —
+ * only gets exercised if a test asks for it. */
+test.describe('native tool verified mark on a touch viewport', () => {
+ /** Only the context knobs: spreading the whole device descriptor would carry
+ * `defaultBrowserType`, which Playwright refuses inside a describe. */
+ test.use({ viewport: devices['Pixel 7'].viewport, hasTouch: true });
+
+ test('@scenario:verified-mark-survives-a-touch-viewport a native tool keeps its mark where there is no hover', async ({
+ page,
+ }) => {
+ test.setTimeout(120000);
+ const dialog = await openToolLibrary(page);
+
+ const mark = verifiedMark(dialog);
+ await expect(mark).toBeVisible();
+ expect(await page.evaluate(() => matchMedia('(hover: hover)').matches)).toBe(false);
+
+ const paint = await paintOf(mark);
+ expect(paint.badgeStroke).toBe('none');
+ expect(contrast(paint.color, paint.checkStroke)).toBeGreaterThanOrEqual(MARK_FLOOR);
+
+ const card = mark.locator(CARD_FROM_MARK);
+ const resting = await card.evaluate((element) => getComputedStyle(element).backgroundColor);
+ const behind = resting.endsWith(', 0)')
+ ? await dialog.evaluate((element) => getComputedStyle(element).backgroundColor)
+ : resting;
+ expect(contrast(paint.color, behind)).toBeGreaterThanOrEqual(MARK_FLOOR);
+ });
+});
diff --git a/packages/client/src/svgs/VerifiedIcon.tsx b/packages/client/src/svgs/VerifiedIcon.tsx
new file mode 100644
index 0000000000..8866b5d28b
--- /dev/null
+++ b/packages/client/src/svgs/VerifiedIcon.tsx
@@ -0,0 +1,40 @@
+import { JSX } from 'react/jsx-runtime';
+import type { SVGProps } from 'react';
+import { cn } from '~/utils';
+
+/** Verified mark for a first-party item: a scalloped badge filled with
+ * `currentColor` (pair it with `text-status-verified`) carrying a check in
+ * `text-on-status`. The badge is painted, never stroked — an outline would
+ * read as a light halo against the card it sits on. */
+export default function VerifiedIcon({
+ className,
+ ...props
+}: SVGProps<SVGSVGElement>): JSX.Element {
+ const labelled = props['aria-label'] != null || props['aria-labelledby'] != null;
+ return (
+ <svg
+ viewBox="0 0 24 24"
+ fill="none"
+ height="1em"
+ width="1em"
+ xmlns="http://www.w3.org/2000/svg"
+ role={labelled ? 'img' : undefined}
+ aria-hidden={labelled ? undefined : true}
+ focusable="false"
+ className={cn('h-4 w-4', className)}
+ {...props}
+ >
+ <path
+ d="M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z"
+ fill="currentColor"
+ />
+ <path
+ d="m8.4 12.3 2.5 2.5 4.7-4.7"
+ className="stroke-text-on-status"
+ strokeWidth="2.5"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ />
+ </svg>
+ );
+}
diff --git a/packages/client/src/svgs/index.ts b/packages/client/src/svgs/index.ts
index 1d67d44552..7c0a8e4cee 100644
--- a/packages/client/src/svgs/index.ts
+++ b/packages/client/src/svgs/index.ts
@@ -9,6 +9,7 @@ export { default as MobileSidebar } from './MobileSidebar';
export { default as Spinner } from './Spinner';
export { default as Clipboard } from './Clipboard';
export { default as CheckMark } from './CheckMark';
+export { default as VerifiedIcon } from './VerifiedIcon';
export { default as CrossIcon } from './CrossIcon';
export { default as LogOutIcon } from './LogOutIcon';
export { default as CustomMinimalIcon } from './CustomMinimalIcon';
diff --git a/packages/client/src/theme/README.md b/packages/client/src/theme/README.md
index f5dfd395a5..ba7b308720 100644
--- a/packages/client/src/theme/README.md
+++ b/packages/client/src/theme/README.md
@@ -226,6 +226,9 @@ Each status family has a foreground, a `-subtle` background, a `-border`, and a
- `text-status-error` / `bg-status-error-subtle` / `border-status-error-border`
- `text-status-neutral` / `bg-status-neutral-subtle` / `border-status-neutral-border`
- `bg-status-success-strong` / `bg-status-info-strong` / `bg-status-warning-strong` / `bg-status-error-strong`
+- `text-status-verified` — fill of the verified mark `VerifiedIcon` paints,
+ carrying a `stroke-text-on-status` check. See `rgb-status-verified` in
+ `types/index.ts` for why it is its own role and what a pre-token theme gets.
### Other Colors
diff --git a/packages/client/src/theme/context/ThemeProvider.tsx b/packages/client/src/theme/context/ThemeProvider.tsx
index 231ad9942d..75cb86fa1a 100644
--- a/packages/client/src/theme/context/ThemeProvider.tsx
+++ b/packages/client/src/theme/context/ThemeProvider.tsx
@@ -16,6 +16,8 @@ import {
validateThemeDefinition,
} from '../registry';
import applyTheme, { applyResolvedTheme, themeOwnedProperties } from '../utils/applyTheme';
+import { defaultTheme } from '../themes/default';
+import { darkTheme } from '../themes/dark';
import '../highContrast.css';
const THEME_KEY = 'color-theme';
@@ -626,7 +628,7 @@ export function ThemeProvider({
}
if (!highContrast && legacyThemeRGB) {
- applyTheme(legacyThemeRGB, root);
+ applyTheme(legacyThemeRGB, root, mode === 'dark' ? darkTheme : defaultTheme);
root.dataset.theme = definition.name;
return;
}
diff --git a/packages/client/src/theme/registry.spec.ts b/packages/client/src/theme/registry.spec.ts
index 5407c4e085..e99d699b26 100644
--- a/packages/client/src/theme/registry.spec.ts
+++ b/packages/client/src/theme/registry.spec.ts
@@ -294,6 +294,71 @@ describe('theme registry', () => {
);
});
+ it('keeps the verified mark on the success fill a theme already named', () => {
+ const resolved = resolveTheme(
+ {
+ version: 1,
+ name: 'legacy-verified-reference',
+ modes: { dark: { colors: { 'rgb-status-success-strong': '8 135 89' } } },
+ },
+ 'dark',
+ );
+
+ expect(resolved.colors['rgb-status-verified']).toBe('8 135 89');
+ });
+
+ it('keeps the verified mark on a success fill the theme only inherits', () => {
+ const resolved = resolveTheme(
+ {
+ version: 1,
+ name: 'partial-verified-reference',
+ modes: { dark: { colors: { 'rgb-surface-tertiary': '30 30 38' } } },
+ },
+ 'dark',
+ );
+
+ expect(resolved.colors['rgb-status-verified']).toBe(darkTheme['rgb-status-success-strong']);
+ });
+
+ it('keeps the bundled verified fill for a theme with no colors of its own', () => {
+ expect(resolveTheme(libreChatTheme, 'dark').colors['rgb-status-verified']).toBe(
+ darkTheme['rgb-status-verified'],
+ );
+ });
+
+ it('keeps the bundled verified fill for a theme that repaints nothing around the mark', () => {
+ const resolved = resolveTheme(
+ {
+ version: 1,
+ name: 'unrelated-partial-reference',
+ modes: { dark: { colors: { 'rgb-text-primary': '250 250 250' } } },
+ },
+ 'dark',
+ );
+
+ expect(resolved.colors['rgb-status-verified']).toBe(darkTheme['rgb-status-verified']);
+ });
+
+ it('preserves an explicit verified fill', () => {
+ const resolved = resolveTheme(
+ {
+ version: 1,
+ name: 'explicit-verified-reference',
+ modes: {
+ dark: {
+ colors: {
+ 'rgb-status-success-strong': '8 135 89',
+ 'rgb-status-verified': '26 127 216',
+ },
+ },
+ },
+ },
+ 'dark',
+ );
+
+ expect(resolved.colors['rgb-status-verified']).toBe('26 127 216');
+ });
+
it('resolves provider brand tokens and lets a theme override them', () => {
const defaults = resolveTheme(libreChatTheme, 'light');
expect(defaults.brands['provider-anthropic']).toBe('#d09a74');
diff --git a/packages/client/src/theme/registry.ts b/packages/client/src/theme/registry.ts
index b2fd084315..ef4f061058 100644
--- a/packages/client/src/theme/registry.ts
+++ b/packages/client/src/theme/registry.ts
@@ -32,6 +32,20 @@ export const themeColorTokens: readonly (keyof IThemeRGB)[] = Object.freeze(
Object.keys(defaultTheme) as Array<keyof IThemeRGB>,
);
+/**
+ * What the verified mark is measured against: the fill it wore before it had a
+ * token, the check it carries, and the backgrounds `ToolCard` takes at rest and
+ * on hover. A theme naming any of these coordinated the mark; one naming none
+ * of them never looked at it.
+ */
+export const MARK_NEIGHBOURHOOD: readonly (keyof IThemeRGB)[] = Object.freeze([
+ 'rgb-status-success-strong',
+ 'rgb-text-on-status',
+ 'rgb-surface-dialog',
+ 'rgb-surface-secondary',
+ 'rgb-surface-tertiary',
+]);
+
export const themeAppearanceProperties: Readonly<
Record<keyof IThemeAppearance, `--theme-${string}`>
> = Object.freeze({
@@ -415,6 +429,26 @@ export function resolveTheme(theme: ThemeDefinition, mode: ThemeMode): ResolvedT
'rgb-series-8': customColors?.['rgb-text-secondary'] ?? baseColors['rgb-text-secondary'],
}
: {};
+ /**
+ * The verified mark was painted with `status-success-strong` until it earned
+ * its own token, so a theme that paints what the mark is measured against —
+ * the fill it used to wear, the check it carries, or the card it sits on —
+ * coordinated that green and cannot have named the blue. Dropping LibreChat's
+ * stock blue into such a palette puts an unchecked pairing on surfaces the
+ * theme chose; keeping the old fill preserves the relationship it did check.
+ * A theme that repaints anything else keeps the bundled default, and any
+ * theme takes the blue by naming the token, the way
+ * `rgb-surface-composer-hover` opts out of its own fallback.
+ */
+ const ownsMarkSurroundings =
+ customColors != null && MARK_NEIGHBOURHOOD.some((token) => customColors[token] !== undefined);
+ const verifiedFallback =
+ ownsMarkSurroundings && customColors?.['rgb-status-verified'] === undefined
+ ? {
+ 'rgb-status-verified':
+ customColors?.['rgb-status-success-strong'] ?? baseColors['rgb-status-success-strong'],
+ }
+ : {};
return {
version: THEME_VERSION,
@@ -430,6 +464,7 @@ export function resolveTheme(theme: ThemeDefinition, mode: ThemeMode): ResolvedT
...chartWidgetSurfaceFallback,
...chartWidgetStrokeFallback,
...seriesEightFallback,
+ ...verifiedFallback,
} as Required<IThemeRGB>,
appearance: { ...defaultAppearance, ...definition?.appearance },
/** Mode last: a mode override is more specific than the theme-wide set. */
diff --git a/packages/client/src/theme/semanticTokens.spec.ts b/packages/client/src/theme/semanticTokens.spec.ts
index ffe1459a94..cf3840d624 100644
--- a/packages/client/src/theme/semanticTokens.spec.ts
+++ b/packages/client/src/theme/semanticTokens.spec.ts
@@ -427,6 +427,66 @@ describe('success fill defaults', () => {
});
});
+/** `status-verified` paints one thing: the check a first-party item wears next
+ * to its name. Both of its relationships are graphical objects under WCAG
+ * 1.4.11, so both owe 3:1 and neither owes AA: the badge against the card it
+ * sits on, and the `text-on-status` check against the badge. That is where it
+ * parts from the success fill above, which carries a text label and therefore
+ * owes AA. The card is not one surface — `ToolCard` rests on the dialog and
+ * repaints to `surface-tertiary` on hover — so the silhouette is checked
+ * against every background the card can take. Separate from
+ * `status-success-strong` on purpose: green already means selected on the same
+ * card, so provenance needs its own hue. */
+describe.each([
+ ['default', defaultTheme],
+ ['dark', darkTheme],
+ ['high contrast light', highContrastLightTheme],
+ ['high contrast dark', highContrastDarkTheme],
+])('%s verified fill', (_name, theme: IThemeRGB) => {
+ it('carries its check at the 3:1 mark floor', () => {
+ const ratio = contrast(toRgb(theme, 'rgb-status-verified'), toRgb(theme, 'rgb-text-on-status'));
+ expect(ratio).toBeGreaterThanOrEqual(WCAG_MARK_MIN);
+ });
+
+ it('keeps its silhouette at the 3:1 mark floor on every card state', () => {
+ const mark = toRgb(theme, 'rgb-status-verified');
+ /** Resting card, the panel behind the grid, and the hover repaint from
+ * `ToolCard`'s `hover:bg-surface-tertiary`. */
+ const surfaces: Array<keyof IThemeRGB> = [
+ 'rgb-surface-dialog',
+ 'rgb-surface-secondary',
+ 'rgb-surface-tertiary',
+ ];
+
+ const failures = surfaces.flatMap((surface) => {
+ const ratio = contrast(mark, toRgb(theme, surface));
+ return ratio < WCAG_MARK_MIN ? [`${surface}: ${ratio.toFixed(2)}:1`] : [];
+ });
+
+ expect(failures).toEqual([]);
+ });
+});
+
+describe('verified fill defaults', () => {
+ /** Tuned values rather than palette steps in either mode, so the stylesheet
+ * cannot alias them to a `--blue-*` step and both copies move together. */
+ it('keeps the app CSS in step with the runtime themes', () => {
+ const appStyles = readFileSync(
+ join(__dirname, '..', '..', '..', '..', 'client', 'src', 'style.css'),
+ 'utf8',
+ );
+
+ const declared = [...appStyles.matchAll(/--status-verified:\s*([^;]+);/g)].map((match) =>
+ match[1].trim(),
+ );
+
+ expect(declared).toEqual([
+ defaultTheme['rgb-status-verified'],
+ darkTheme['rgb-status-verified'],
+ ]);
+ });
+});
+
/** The shared `Switch` paints this track, so it travels with the package rather
* than the app stylesheet. It is a UI component boundary under WCAG 1.4.11 and
* has to stay distinct from the `surface-primary` thumb on it and from the
diff --git a/packages/client/src/theme/themes/dark.ts b/packages/client/src/theme/themes/dark.ts
index 65dcf7786e..349c173ce1 100644
--- a/packages/client/src/theme/themes/dark.ts
+++ b/packages/client/src/theme/themes/dark.ts
@@ -94,6 +94,15 @@ export const darkTheme: IThemeRGB = {
'rgb-status-neutral': '205 205 205', // #cdcdcd (gray-300)
'rgb-status-neutral-subtle': '33 33 33', // #212121 (gray-800)
'rgb-status-neutral-border': '47 47 47', // #2f2f2f (gray-700)
+ /** Verified mark. Not `status-info`'s `blue-300`, which is a text hue and
+ * leaves a white check at 1.35:1. The card it sits on is `surface-dialog`
+ * at rest and `surface-tertiary` (#2f2f2f) on hover, and that hover is the
+ * binding constraint: `#0b74d4` held the panel at 3.42:1 but fell to 2.85:1
+ * there. Both relationships are graphical (WCAG 1.4.11): 3.23:1 against the
+ * hover surface, 4.52:1 against the resting dialog, and 4.14:1 under the
+ * white `text-on-status` check. No hue clears 3:1 on #2f2f2f and 4.5:1
+ * under a white check at once — the check would have to stop being white. */
+ 'rgb-status-verified': '26 127 216', // #1a7fd8
'rgb-text-on-status': '255 255 255', // #fff (white)
// Brand colors
diff --git a/packages/client/src/theme/themes/default.ts b/packages/client/src/theme/themes/default.ts
index a21426d622..b3304a28cf 100644
--- a/packages/client/src/theme/themes/default.ts
+++ b/packages/client/src/theme/themes/default.ts
@@ -89,6 +89,10 @@ export const defaultTheme: IThemeRGB = {
'rgb-status-neutral': '66 66 66', // #424242 (gray-600)
'rgb-status-neutral-subtle': '236 236 236', // #ececec (gray-100)
'rgb-status-neutral-border': '205 205 205', // #cdcdcd (gray-300)
+ /** Verified mark. `blue-600` doubles as `status-info` here, and that is the
+ * point: one blue for "this is informational/first-party", 5.17:1 under the
+ * white label and 4.83:1 against the panel. */
+ 'rgb-status-verified': '37 99 235', // #2563eb (blue-600)
'rgb-text-on-status': '255 255 255', // #fff (white)
// Brand colors
diff --git a/packages/client/src/theme/themes/highContrast.spec.ts b/packages/client/src/theme/themes/highContrast.spec.ts
index 2ec32c4055..e803c74dc8 100644
--- a/packages/client/src/theme/themes/highContrast.spec.ts
+++ b/packages/client/src/theme/themes/highContrast.spec.ts
@@ -97,6 +97,7 @@ const solidFills: Array<keyof IThemeRGB> = [
'rgb-status-info-strong',
'rgb-status-warning-strong',
'rgb-status-error-strong',
+ 'rgb-status-verified',
];
const borderTokens: Array<keyof IThemeRGB> = [
diff --git a/packages/client/src/theme/themes/highContrast.ts b/packages/client/src/theme/themes/highContrast.ts
index 5140c07b74..1fffc3f38f 100644
--- a/packages/client/src/theme/themes/highContrast.ts
+++ b/packages/client/src/theme/themes/highContrast.ts
@@ -125,6 +125,9 @@ export const highContrastLightTheme: IThemeRGB = {
'rgb-status-neutral': '0 0 0', // #000000
'rgb-status-neutral-subtle': '255 255 255', // #ffffff
'rgb-status-neutral-border': '0 0 0', // #000000
+ /** Verified mark: the mode's one blue, 10.31:1 under the white check and the
+ * same against the canvas. */
+ 'rgb-status-verified': '0 65 122', // #00417a
'rgb-text-on-status': '255 255 255', // #ffffff
// Brand colors
@@ -262,6 +265,9 @@ export const highContrastDarkTheme: IThemeRGB = {
'rgb-status-neutral': '255 255 255', // #ffffff
'rgb-status-neutral-subtle': '0 0 0', // #000000
'rgb-status-neutral-border': '255 255 255', // #ffffff
+ /** Verified mark: the mode's one blue, 11.82:1 under the black check and the
+ * same against the canvas. */
+ 'rgb-status-verified': '140 200 255', // #8cc8ff
'rgb-text-on-status': '0 0 0', // #000000
// Brand colors
diff --git a/packages/client/src/theme/types/index.ts b/packages/client/src/theme/types/index.ts
index 7582c558c9..feccc48ff1 100644
--- a/packages/client/src/theme/types/index.ts
+++ b/packages/client/src/theme/types/index.ts
@@ -90,6 +90,19 @@ export interface IThemeRGB {
'rgb-status-neutral'?: string;
'rgb-status-neutral-subtle'?: string;
'rgb-status-neutral-border'?: string;
+ /**
+ * Solid fill of the verified mark — the badge a first-party item carries next
+ * to its name. The one status with no family around it: the mark is the only
+ * thing it paints, so there is no subtle fill, border or text weight to go
+ * with it. Blue rather than a reuse of `status-success-strong`, because a
+ * green check is the selected/complete cue everywhere else in the product
+ * (including the selected-tool check on the very same card) while blue is the
+ * cross-product convention for provenance. It carries `text-on-status`.
+ * A theme that repaints the mark's surroundings — the old
+ * `status-success-strong` fill, the check, or the card surfaces — keeps the
+ * mark on that success fill, which is what it wore before this token existed.
+ */
+ 'rgb-status-verified'?: string;
'rgb-text-on-status'?: string;
// Brand colors
@@ -214,6 +227,7 @@ export interface IThemeVariables {
'--status-neutral': string;
'--status-neutral-subtle': string;
'--status-neutral-border': string;
+ '--status-verified': string;
'--text-on-status': string;
'--brand-purple': string;
@@ -313,6 +327,7 @@ export interface IThemeColors {
'status-neutral'?: string;
'status-neutral-subtle'?: string;
'status-neutral-border'?: string;
+ 'status-verified'?: string;
'text-on-status'?: string;
'brand-purple'?: string;
diff --git a/packages/client/src/theme/utils/applyTheme.spec.ts b/packages/client/src/theme/utils/applyTheme.spec.ts
index a27c348bc0..dec4725436 100644
--- a/packages/client/src/theme/utils/applyTheme.spec.ts
+++ b/packages/client/src/theme/utils/applyTheme.spec.ts
@@ -238,6 +238,45 @@ describe('applyTheme', () => {
expect(root.style.getPropertyValue('--chart-widget-stroke')).toBe('50 51 52');
});
+ it('carries a legacy theme without a verified fill onto its success fill', () => {
+ const root = document.documentElement;
+
+ applyTheme({ 'rgb-status-success-strong': '8 135 89' }, root);
+
+ expect(root.style.getPropertyValue('--status-verified')).toBe('8 135 89');
+ });
+
+ it('leaves a legacy theme that names its own verified fill alone', () => {
+ const root = document.documentElement;
+
+ applyTheme(
+ { 'rgb-status-success-strong': '8 135 89', 'rgb-status-verified': '26 127 216' },
+ root,
+ );
+
+ expect(root.style.getPropertyValue('--status-verified')).toBe('26 127 216');
+ });
+
+ it('carries a legacy theme that names no fills onto the mode palette it inherits', () => {
+ const root = document.documentElement;
+
+ applyTheme({ 'rgb-surface-tertiary': '30 30 38' }, root, {
+ 'rgb-status-success-strong': '8 135 89',
+ });
+
+ expect(root.style.getPropertyValue('--status-verified')).toBe('8 135 89');
+ });
+
+ it('leaves the verified fill alone for a legacy theme that repaints nothing around the mark', () => {
+ const root = document.documentElement;
+
+ applyTheme({ 'rgb-text-primary': '10 20 30' }, root, {
+ 'rgb-status-success-strong': '8 135 89',
+ });
+
+ expect(root.style.getPropertyValue('--status-verified')).toBe('');
+ });
+
it('clears only properties owned by the theme module', () => {
const root = document.documentElement;
root.style.setProperty('--text-primary', '1 2 3');
diff --git a/packages/client/src/theme/utils/applyTheme.ts b/packages/client/src/theme/utils/applyTheme.ts
index d5a209949c..eed64f5731 100644
--- a/packages/client/src/theme/utils/applyTheme.ts
+++ b/packages/client/src/theme/utils/applyTheme.ts
@@ -1,5 +1,10 @@
import type { IThemeAppearance, IThemeBrands, IThemeRGB, ResolvedThemeDefinition } from '../types';
-import { themeAppearanceProperties, themeBrandTokens, themeColorTokens } from '../registry';
+import {
+ MARK_NEIGHBOURHOOD,
+ themeAppearanceProperties,
+ themeBrandTokens,
+ themeColorTokens,
+} from '../registry';
const colorProperty = (token: keyof IThemeRGB): `--${string}` => `--${token.slice(4)}`;
const brandProperty = (token: keyof IThemeBrands): `--${string}` => `--${token}`;
@@ -17,7 +22,10 @@ function validateRGB(rgb: string): boolean {
return match !== null && match.slice(1).every((channel) => Number(channel) <= 255);
}
-function mapColors(colors: IThemeRGB): Array<[string, string]> {
+/** `base` is the bundled palette for the mode being applied. The adapter writes
+ * only the keys a theme names, so a derivation whose source the theme inherits
+ * rather than restates has nothing to read without it. */
+function mapColors(colors: IThemeRGB, base?: IThemeRGB): Array<[string, string]> {
const variables = themeColorTokens.reduce<Array<[string, string]>>((result, token) => {
const value = colors[token];
if (value !== undefined) {
@@ -62,6 +70,24 @@ function mapColors(colors: IThemeRGB): Array<[string, string]> {
variables.push(['--chart-widget-stroke', colors['rgb-border-light']]);
}
+ /**
+ * Same rule as `resolveTheme`: a theme that paints what the mark is measured
+ * against coordinated the `status-success-strong` the mark wore before it had
+ * a token, so it keeps that fill rather than taking LibreChat's stock blue.
+ * This adapter writes only the keys a theme names, so the inherited value
+ * arrives through `base`, the bundled palette for the mode being applied.
+ */
+ const ownsMarkSurroundings = MARK_NEIGHBOURHOOD.some((token) => colors[token] !== undefined);
+ const inheritedSuccess =
+ colors['rgb-status-success-strong'] ?? base?.['rgb-status-success-strong'];
+ if (
+ ownsMarkSurroundings &&
+ colors['rgb-status-verified'] === undefined &&
+ inheritedSuccess !== undefined
+ ) {
+ variables.push(['--status-verified', inheritedSuccess]);
+ }
+
return variables;
}
@@ -100,12 +126,13 @@ export function applyResolvedTheme(
export default function applyTheme(
themeRGB?: IThemeRGB,
root: HTMLElement = document.documentElement,
+ base?: IThemeRGB,
): void {
if (!themeRGB) {
return;
}
- mapColors(themeRGB).forEach(([property, value]) => {
+ mapColors(themeRGB, base).forEach(([property, value]) => {
if (!validateRGB(value)) {
console.error(`Invalid RGB value for ${property}: ${value}`);
return;
diff --git a/packages/client/src/theme/utils/createTailwindColors.js b/packages/client/src/theme/utils/createTailwindColors.js
index 050868fb56..3c5c044a7f 100644
--- a/packages/client/src/theme/utils/createTailwindColors.js
+++ b/packages/client/src/theme/utils/createTailwindColors.js
@@ -140,6 +140,7 @@ function createTailwindColors() {
'status-neutral': cssVar('--status-neutral'),
'status-neutral-subtle': cssVar('--status-neutral-subtle'),
'status-neutral-border': cssVar('--status-neutral-border'),
+ 'status-verified': cssVar('--status-verified'),
'text-on-status': cssVar('--text-on-status'),
'series-1': cssVar('--series-1'),