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

🧪 test: Pin Brand Tokens and Renamed Roles Outside the Color Registry (#17355)

Marco Berettaaf7e4d7ce139
diff --git a/e2e/specs/mock/scenarios/provider-brand-tokens.spec.ts b/e2e/specs/mock/scenarios/provider-brand-tokens.spec.ts
new file mode 100644
index 0000000000..e68088b016
--- /dev/null
+++ b/e2e/specs/mock/scenarios/provider-brand-tokens.spec.ts
@@ -0,0 +1,27 @@
+import { expect, test } from '@playwright/test';
+import { NEW_CHAT_PATH } from '../helpers';
+
+/**
+ * Provider brand tokens are bare custom properties on the document root
+ * (`--provider-*`), declared by the theme defaults, and are not exposed as
+ * `--color-*` utilities. The served app is the only place both stylesheets are
+ * parsed together, so this reads what the browser resolves.
+ */
+test.describe('provider brand tokens', () => {
+ test('@scenario:provider-brand-tokens-are-bare-custom-properties a brand token resolves on the root without a color utility', async ({
+ page,
+ }) => {
+ await page.goto(NEW_CHAT_PATH, { timeout: 10000 });
+
+ const resolved = await page.evaluate(() => {
+ const style = getComputedStyle(document.documentElement);
+ return {
+ brand: style.getPropertyValue('--provider-anthropic').trim(),
+ utility: style.getPropertyValue('--color-provider-anthropic').trim(),
+ };
+ });
+
+ expect(resolved.brand).not.toBe('');
+ expect(resolved.utility).toBe('');
+ });
+});
diff --git a/packages/client/src/theme/tokens.spec.ts b/packages/client/src/theme/tokens.spec.ts
index 1d9639c10f..e4d23e15e7 100644
--- a/packages/client/src/theme/tokens.spec.ts
+++ b/packages/client/src/theme/tokens.spec.ts
@@ -3,7 +3,13 @@ import path from 'path';
import fsp from 'fs/promises';
import { compile } from 'tailwindcss';
import { deserialize, serialize } from 'v8';
-import { defaultTheme, themeColorTokens, themeDerivedColorTokens } from 'librechat-data-provider';
+import {
+ defaultTheme,
+ themeBrandTokens,
+ themeColorTokens,
+ themeDerivedColorTokens,
+ renamedThemeColorTokens,
+} from 'librechat-data-provider';
/** Tailwind's compiler clones its theme with `structuredClone`, which jsdom does not provide.
* V8 serialization is the same structured-clone algorithm Node's global uses. */
@@ -67,6 +73,23 @@ describe('theme color tokens', () => {
expect([...declared].filter((token) => !registry.has(token))).toEqual([]);
});
+ it('keeps brand tokens and renamed roles out of the color registry', () => {
+ const colorRoles = new Set<string>(themeColorTokens);
+ const defaults = fs.readFileSync(path.resolve(__dirname, 'defaults.css'), 'utf8');
+
+ /** Brand tokens are bare custom properties (`--provider-*`), never `--color-*` utilities. */
+ expect(themeBrandTokens.filter((token) => declared.has(token))).toEqual([]);
+ expect(themeBrandTokens.filter((token) => !defaults.includes(`--${token}:`))).toEqual([]);
+ expect(themeBrandTokens.filter((token) => colorRoles.has(`rgb-${token}`))).toEqual([]);
+
+ /** A renamed role keeps no utility of its own: only the name it moved to is declared. */
+ for (const [legacy, current] of renamedThemeColorTokens) {
+ expect(colorRoles.has(legacy)).toBe(false);
+ expect(declared.has(legacy.replace(/^rgb-/, ''))).toBe(false);
+ expect(declared.has(current.replace(/^rgb-/, ''))).toBe(true);
+ }
+ });
+
it('lets a theme set every color token the stylesheet declares', () => {
const registered = new Set(Object.keys(defaultTheme).map((key) => key.replace(/^rgb-/, '')));
const unowned = [...declarations]