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

🎨 a11y: Draw Every Prompt Category Icon Muted Under ClickHouse (#16935)

Marco Berettae4274abf6f5e
diff --git a/client/src/Providers/__tests__/themeCache.spec.ts b/client/src/Providers/__tests__/themeCache.spec.ts
index bcc45ad34f..d63673fcd7 100644
--- a/client/src/Providers/__tests__/themeCache.spec.ts
+++ b/client/src/Providers/__tests__/themeCache.spec.ts
@@ -182,7 +182,7 @@ describe('theme cache storage', () => {
* - definitions with one or both mode blocks absent.
* A new role, or a new fallback, joins by construction.
*/
-const PIN = { fingerprint: '1.3.q7j6x4', digest: '1c7345r' };
+const PIN = { fingerprint: '1.3.fgvuqz', digest: '16q8y55' };
const digestOf = (text: string): string => {
let hash = 5381;
diff --git a/client/src/components/Prompts/utils/CategoryIcon.spec.tsx b/client/src/components/Prompts/utils/CategoryIcon.spec.tsx
index 41161db0bc..bb5f71f83e 100644
--- a/client/src/components/Prompts/utils/CategoryIcon.spec.tsx
+++ b/client/src/components/Prompts/utils/CategoryIcon.spec.tsx
@@ -3,21 +3,21 @@ import { render } from '@testing-library/react';
import CategoryIcon from './CategoryIcon';
const categoryColors = {
- code: 'text-series-5',
- misc: 'text-series-1',
- shop: 'text-series-6',
- idea: 'text-category-icon',
- write: 'text-series-6',
- travel: 'text-category-icon',
- finance: 'text-series-2',
- roleplay: 'text-series-2',
- teach_or_explain: 'text-series-1',
- general: 'text-series-1',
- hr: 'text-series-7',
- rd: 'text-series-6',
- it: 'text-series-5',
- sales: 'text-series-2',
- aftersales: 'text-category-icon',
+ code: 'text-category-icon-5',
+ misc: 'text-category-icon-1',
+ shop: 'text-category-icon-6',
+ idea: 'text-category-icon-4',
+ write: 'text-category-icon-6',
+ travel: 'text-category-icon-4',
+ finance: 'text-category-icon-2',
+ roleplay: 'text-category-icon-2',
+ teach_or_explain: 'text-category-icon-1',
+ general: 'text-category-icon-1',
+ hr: 'text-category-icon-7',
+ rd: 'text-category-icon-6',
+ it: 'text-category-icon-5',
+ sales: 'text-category-icon-2',
+ aftersales: 'text-category-icon-4',
};
describe('CategoryIcon', () => {
diff --git a/client/src/components/Prompts/utils/CategoryIcon.tsx b/client/src/components/Prompts/utils/CategoryIcon.tsx
index c9edd4f367..22845f2b16 100644
--- a/client/src/components/Prompts/utils/CategoryIcon.tsx
+++ b/client/src/components/Prompts/utils/CategoryIcon.tsx
@@ -35,21 +35,21 @@ const categoryIconMap: Record<string, React.ElementType> = {
};
const categoryColorMap: Record<string, string> = {
- code: 'text-series-5',
- misc: 'text-series-1',
- shop: 'text-series-6',
- idea: 'text-category-icon',
- write: 'text-series-6',
- travel: 'text-category-icon',
- finance: 'text-series-2',
- roleplay: 'text-series-2',
- teach_or_explain: 'text-series-1',
- general: 'text-series-1',
- hr: 'text-series-7',
- rd: 'text-series-6',
- it: 'text-series-5',
- sales: 'text-series-2',
- aftersales: 'text-category-icon',
+ code: 'text-category-icon-5',
+ misc: 'text-category-icon-1',
+ shop: 'text-category-icon-6',
+ idea: 'text-category-icon-4',
+ write: 'text-category-icon-6',
+ travel: 'text-category-icon-4',
+ finance: 'text-category-icon-2',
+ roleplay: 'text-category-icon-2',
+ teach_or_explain: 'text-category-icon-1',
+ general: 'text-category-icon-1',
+ hr: 'text-category-icon-7',
+ rd: 'text-category-icon-6',
+ it: 'text-category-icon-5',
+ sales: 'text-category-icon-2',
+ aftersales: 'text-category-icon-4',
};
export default function CategoryIcon({
diff --git a/client/src/utils/getThemeFromEnv.js b/client/src/utils/getThemeFromEnv.js
index 5be2941f2b..131b25716c 100644
--- a/client/src/utils/getThemeFromEnv.js
+++ b/client/src/utils/getThemeFromEnv.js
@@ -1,4 +1,4 @@
-import { themeColorTokens } from '@librechat/client';
+import { renamedColorTokens, themeColorTokens } from '@librechat/client';
const toEnvName = (token) => `REACT_APP_THEME_${token.slice(4).toUpperCase().replace(/-/g, '_')}`;
@@ -16,6 +16,12 @@ export function getThemeFromEnv(env = import.meta.env) {
}
return colors;
}, {});
+ renamedColorTokens.forEach(([from, to]) => {
+ const value = env[toEnvName(from)];
+ if (value && theme[to] === undefined) {
+ theme[to] = value;
+ }
+ });
return Object.keys(theme).length > 0 ? theme : undefined;
}
diff --git a/client/src/utils/getThemeFromEnv.spec.js b/client/src/utils/getThemeFromEnv.spec.js
index 7b5103e1bd..f140afa1a3 100644
--- a/client/src/utils/getThemeFromEnv.spec.js
+++ b/client/src/utils/getThemeFromEnv.spec.js
@@ -1,6 +1,18 @@
import { getThemeFromEnv } from './getThemeFromEnv';
describe('getThemeFromEnv', () => {
+ it('reads a renamed role from its old variable unless the current one is set', () => {
+ expect(getThemeFromEnv({ REACT_APP_THEME_CATEGORY_ICON: '1 2 3' })).toEqual({
+ 'rgb-category-icon-4': '1 2 3',
+ });
+ expect(
+ getThemeFromEnv({
+ REACT_APP_THEME_CATEGORY_ICON: '1 2 3',
+ REACT_APP_THEME_CATEGORY_ICON_4: '4 5 6',
+ }),
+ ).toEqual({ 'rgb-category-icon-4': '4 5 6' });
+ });
+
it('loads link and accent colors', () => {
expect(
getThemeFromEnv({
diff --git a/e2e/specs/mock/scenarios/prompt-category-icon.spec.ts b/e2e/specs/mock/scenarios/prompt-category-icon.spec.ts
index d162f88823..554432ac2c 100644
--- a/e2e/specs/mock/scenarios/prompt-category-icon.spec.ts
+++ b/e2e/specs/mock/scenarios/prompt-category-icon.spec.ts
@@ -1,32 +1,43 @@
import { randomUUID } from 'crypto';
import { expect, test } from '@playwright/test';
import type { Page } from '@playwright/test';
-import type { ThemeDefinition } from '../../../../packages/client/src/theme/types';
+import type { IThemeRGB, ThemeDefinition } from '../../../../packages/client/src/theme/types';
import { clickHouseTheme } from '../../../../packages/client/src/theme/themes/clickhouse';
+import { defaultTheme } from '../../../../packages/client/src/theme/themes/default';
+import { darkTheme } from '../../../../packages/client/src/theme/themes/dark';
import { getAccessToken, requestJson } from '../helpers';
import { openPanel } from './panels';
/**
- * The prompt category icons that drew in the `series-4` chart slot (idea, travel, aftersales) read
- * the `category-icon` role. The stock palettes keep it on `series-4`; ClickHouse quiets it to its
- * muted text, which clears the 3:1 WCAG 1.4.11 (Non-text Contrast) floor on the panel and on a
- * hovered row, where Click UI's fuchsia did not.
+ * Each prompt category icon reads the `category-icon-N` role for the series slot it drew in. The
+ * stock palettes keep every role on its `series-N`; ClickHouse draws all of them in its muted text,
+ * which clears the 3:1 WCAG 1.4.11 (Non-text Contrast) floor on the panel and on a hovered row,
+ * where several of Click UI's chart colours did not.
*/
-test.describe.configure({ timeout: 90_000 });
+test.describe.configure({ timeout: 120_000 });
type Mode = 'light' | 'dark';
type CreatedGroup = { group?: { _id: string } };
+type Paint = { color: string; background: string };
const WCAG_NON_TEXT_MIN = 3;
-const STOCK_SERIES_4: Record<Mode, string> = {
- light: 'rgb(182, 123, 5)',
- dark: 'rgb(200, 133, 12)',
-};
+/** One category per series slot the icons use. */
+const SLOT_CATEGORIES = [
+ ['1', 'misc'],
+ ['2', 'finance'],
+ ['4', 'idea'],
+ ['5', 'code'],
+ ['6', 'write'],
+ ['7', 'hr'],
+] as const;
+const STOCK: Record<Mode, IThemeRGB> = { light: defaultTheme, dark: darkTheme };
const CLICKHOUSE_MUTED: Record<Mode, string> = {
light: 'rgb(105, 110, 121)',
dark: 'rgb(179, 182, 189)',
};
+const rgbCss = (triplet: string | undefined) => `rgb(${(triplet ?? '').split(' ').join(', ')})`;
+
async function installTheme(page: Page, mode: Mode, definition: ThemeDefinition | null) {
await page.addInitScript(
([storedMode, stored]) => {
@@ -45,7 +56,7 @@ async function installTheme(page: Page, mode: Mode, definition: ThemeDefinition
);
}
-async function createIdeaGroup(page: Page, name: string): Promise<string> {
+async function createGroup(page: Page, name: string, category: string): Promise<string> {
const token = await getAccessToken(page);
const body = await requestJson<CreatedGroup>(page, {
path: '/api/prompts',
@@ -53,7 +64,7 @@ async function createIdeaGroup(page: Page, name: string): Promise<string> {
method: 'POST',
body: {
prompt: { prompt: `Text for ${name}`, type: 'text' },
- group: { name, category: 'idea' },
+ group: { name, category },
},
});
const id = body.group?._id ?? '';
@@ -61,13 +72,15 @@ async function createIdeaGroup(page: Page, name: string): Promise<string> {
return id;
}
-async function deleteGroup(page: Page, id: string) {
+async function deleteGroups(page: Page, ids: string[]) {
const token = await getAccessToken(page);
- await requestJson<{ message?: string }>(page, {
- path: `/api/prompts/groups/${encodeURIComponent(id)}`,
- token,
- method: 'DELETE',
- });
+ for (const id of ids) {
+ await requestJson<{ message?: string }>(page, {
+ path: `/api/prompts/groups/${encodeURIComponent(id)}`,
+ token,
+ method: 'DELETE',
+ });
+ }
}
const channels = (color: string): number[] =>
@@ -87,94 +100,121 @@ function contrast(foreground: string, background: string): number {
return (lighter + 0.05) / (darker + 0.05);
}
-/** Opens the prompts panel on a fresh idea prompt and reads its icon over the row at rest and, with
- * a pointer, on hover; the row's own fill is transparent at rest, so the first opaque ancestor is
- * the panel. */
-async function categoryIconPaint(page: Page, mode: Mode, definition: ThemeDefinition | null) {
+/**
+ * Opens the prompts panel on one fresh prompt per slot and reads each icon over its row at rest
+ * and, with a pointer, on hover. A row's own fill is transparent at rest, so the first opaque
+ * ancestor is the panel.
+ */
+async function categoryIconPaints(page: Page, mode: Mode, definition: ThemeDefinition | null) {
await installTheme(page, mode, definition);
await page.goto('/c/new', { timeout: 15000 });
- const name = `Category icon ${randomUUID().slice(0, 8)}`;
- const id = await createIdeaGroup(page, name);
+ const prefix = `Category icon ${randomUUID().slice(0, 8)}`;
+ const ids: string[] = [];
try {
+ for (const [slot, category] of SLOT_CATEGORIES) {
+ ids.push(await createGroup(page, `${prefix} ${slot}`, category));
+ }
await page.goto('/c/new', { timeout: 15000 });
await openPanel(page, 'prompts', 'Prompts');
- await page.locator('#prompts-panel').getByRole('search').getByRole('textbox').fill(name);
- const row = page
- .locator('#prompts-panel')
- .getByRole('button', { name: new RegExp(`^${name} prompt`) })
- .locator('..');
- await expect(row).toBeVisible({ timeout: 20000 });
- const icon = row.locator('svg').first();
- const read = () =>
- icon.evaluate((node) => {
- let element: Element | null = node.parentElement;
- let background = 'rgba(0, 0, 0, 0)';
- while (element) {
- const fill = getComputedStyle(element).backgroundColor;
- if (!/rgba\(.*,\s*0\)$/.test(fill) && fill !== 'transparent') {
- background = fill;
- break;
- }
- element = element.parentElement;
- }
- return { color: getComputedStyle(node).color, background };
- });
- const rest = await read();
- /** A touch screen has no hover state to paint, so only a pointer reads the hovered row. */
+ await page.locator('#prompts-panel').getByRole('search').getByRole('textbox').fill(prefix);
const canHover = await page.evaluate(() => matchMedia('(hover: hover)').matches);
- let hover: typeof rest | null = null;
- if (canHover) {
- await page.mouse.move(0, 0);
- await row.hover();
- await expect.poll(async () => (await read()).background).not.toBe(rest.background);
- hover = await read();
+
+ const paints: Array<{ slot: string; rest: Paint; hover: Paint | null }> = [];
+ for (const [slot] of SLOT_CATEGORIES) {
+ const row = page
+ .locator('#prompts-panel')
+ .getByRole('button', { name: new RegExp(`^${prefix} ${slot} prompt`) })
+ .locator('..');
+ await expect(row).toBeVisible({ timeout: 20000 });
+ const icon = row.locator('svg').first();
+ const paintOnce = (): Promise<Paint> =>
+ icon.evaluate((node) => {
+ let element: Element | null = node.parentElement;
+ let background = 'rgba(0, 0, 0, 0)';
+ while (element) {
+ const fill = getComputedStyle(element).backgroundColor;
+ if (!/rgba\(.*,\s*0\)$/.test(fill) && fill !== 'transparent') {
+ background = fill;
+ break;
+ }
+ element = element.parentElement;
+ }
+ return { color: getComputedStyle(node).color, background };
+ });
+ /** The list can swap a row's node while it settles; a detached node computes no style. */
+ const read = async (): Promise<Paint> => {
+ let paint: Paint = { color: '', background: '' };
+ await expect(async () => {
+ paint = await paintOnce();
+ expect(paint.color).not.toBe('');
+ }).toPass({ timeout: 10000 });
+ return paint;
+ };
+ const rest = await read();
+ let hover: Paint | null = null;
+ if (canHover) {
+ await page.mouse.move(0, 0);
+ await row.hover();
+ await expect.poll(async () => (await read()).background).not.toBe(rest.background);
+ hover = await read();
+ }
+ paints.push({ slot, rest, hover });
}
- await test.info().attach(`category-icon-${definition?.name ?? 'stock'}-${mode}`, {
- body: await row.screenshot(),
+ await test.info().attach(`category-icons-${definition?.name ?? 'stock'}-${mode}`, {
+ body: await page.locator('#prompts-panel').screenshot(),
contentType: 'image/png',
});
- return { rest, hover };
+ return paints;
} finally {
- await deleteGroup(page, id);
+ await deleteGroups(page, ids);
}
}
async function expectStock(page: Page, mode: Mode) {
- const { rest } = await categoryIconPaint(page, mode, null);
+ const paints = await categoryIconPaints(page, mode, null);
- expect(rest.color).toBe(STOCK_SERIES_4[mode]);
+ expect(paints.map(({ slot, rest }) => [slot, rest.color])).toEqual(
+ SLOT_CATEGORIES.map(([slot]) => [slot, rgbCss(STOCK[mode][`rgb-series-${slot}`])]),
+ );
}
async function expectClickHouse(page: Page, mode: Mode) {
- const { rest, hover } = await categoryIconPaint(page, mode, clickHouseTheme);
+ const paints = await categoryIconPaints(page, mode, clickHouseTheme);
- expect(rest.color).toBe(CLICKHOUSE_MUTED[mode]);
- expect(contrast(rest.color, rest.background)).toBeGreaterThanOrEqual(WCAG_NON_TEXT_MIN);
- if (hover) {
- expect(contrast(hover.color, hover.background)).toBeGreaterThanOrEqual(WCAG_NON_TEXT_MIN);
- }
+ const failures = paints.flatMap(({ slot, rest, hover }) =>
+ [rest, hover].flatMap((paint) => {
+ if (!paint) {
+ return [];
+ }
+ const ratio = contrast(paint.color, paint.background);
+ return paint.color !== CLICKHOUSE_MUTED[mode] || ratio < WCAG_NON_TEXT_MIN
+ ? [`slot ${slot}: ${paint.color} on ${paint.background} at ${ratio.toFixed(2)}:1`]
+ : [];
+ }),
+ );
+ expect(failures).toEqual([]);
}
-test.describe('prompt category icon role', () => {
- test('stock light keeps the idea icon on series-4 @scenario:prompt-category-icon-stock-light', async ({
+test.describe('prompt category icon roles', () => {
+ test('stock light keeps every category icon on its series slot @scenario:prompt-category-icon-stock-light', async ({
page,
}) => {
await expectStock(page, 'light');
});
- test('stock dark keeps the idea icon on series-4 @scenario:prompt-category-icon-stock-dark', async ({
+ test('stock dark keeps every category icon on its series slot @scenario:prompt-category-icon-stock-dark', async ({
page,
}) => {
await expectStock(page, 'dark');
});
- test('ClickHouse light quiets the idea icon to 3:1 or more @scenario:prompt-category-icon-clickhouse-light', async ({
+ test('ClickHouse light draws every category icon muted at 3:1 or more @scenario:prompt-category-icon-clickhouse-light', async ({
page,
}) => {
await expectClickHouse(page, 'light');
});
- test('ClickHouse dark quiets the idea icon to 3:1 or more @scenario:prompt-category-icon-clickhouse-dark', async ({
+ test('ClickHouse dark draws every category icon muted at 3:1 or more @scenario:prompt-category-icon-clickhouse-dark', async ({
page,
}) => {
await expectClickHouse(page, 'dark');
diff --git a/packages/client/src/theme/README.md b/packages/client/src/theme/README.md
index 6278b66ceb..08c96ca217 100644
--- a/packages/client/src/theme/README.md
+++ b/packages/client/src/theme/README.md
@@ -398,9 +398,10 @@ Each status family has a foreground, a `-subtle` background, a `-border`, and a
(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.
-- `text-category-icon` - The prompt category icons that were drawn in `series-4` (idea, travel
- and aftersales). It follows `series-4`, so a theme can quiet those icons without moving the
- chart slot; ClickHouse draws them in its muted text, as Click UI draws its icons.
+- `text-category-icon-1`, `-2`, `-4`, `-5`, `-6`, `-7` - The prompt category icons, one role per
+ series slot they were drawn in. Each follows its `series-N`, so a theme can quiet the icons
+ without moving the chart slots; ClickHouse draws all of them in its muted text, as Click UI
+ draws its icons.
- Layering roles - `bg-surface-canvas` (the chat canvas and its header fade),
`bg-surface-user-message` (the user turn's bubble), `bg-surface-card` and
`bg-surface-card-hover` (marketplace cards), `bg-surface-nav-hover` and
diff --git a/packages/client/src/theme/defaults.css b/packages/client/src/theme/defaults.css
index 57fa274ca4..0507b2e76f 100644
--- a/packages/client/src/theme/defaults.css
+++ b/packages/client/src/theme/defaults.css
@@ -225,7 +225,12 @@ html {
--series-6: 126 35 205;
--series-7: 1 131 1;
--series-8: 63 81 181;
- --category-icon: var(--series-4);
+ --category-icon-1: var(--series-1);
+ --category-icon-2: var(--series-2);
+ --category-icon-4: var(--series-4);
+ --category-icon-5: var(--series-5);
+ --category-icon-6: var(--series-6);
+ --category-icon-7: var(--series-7);
/* Code syntax highlighting */
--syntax-text: var(--gray-800);
@@ -518,7 +523,12 @@ html {
--series-6: 171 104 254;
--series-7: 80 167 49;
--series-8: 120 130 190;
- --category-icon: var(--series-4);
+ --category-icon-1: var(--series-1);
+ --category-icon-2: var(--series-2);
+ --category-icon-4: var(--series-4);
+ --category-icon-5: var(--series-5);
+ --category-icon-6: var(--series-6);
+ --category-icon-7: var(--series-7);
/* Code syntax highlighting. Comment and meta are the flattened equivalents of
the 50% and 60% alpha whites this palette used before it was tokenized. */
diff --git a/packages/client/src/theme/defaults.spec.ts b/packages/client/src/theme/defaults.spec.ts
index 54e9eb8032..7e8fd1449e 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(163);
+ expect(tokens).toHaveLength(168);
});
it('resolves every registry color to the runtime theme value', () => {
diff --git a/packages/client/src/theme/index.ts b/packages/client/src/theme/index.ts
index 4c2a781589..67b58cf5bc 100644
--- a/packages/client/src/theme/index.ts
+++ b/packages/client/src/theme/index.ts
@@ -37,6 +37,7 @@ export {
themeAppearanceProperties,
themeBrandTokens,
themeColorTokens,
+ renamedColorTokens,
validateThemeDefinition,
} from './registry';
diff --git a/packages/client/src/theme/registry.spec.ts b/packages/client/src/theme/registry.spec.ts
index eb58d0f271..3754e52caa 100644
--- a/packages/client/src/theme/registry.spec.ts
+++ b/packages/client/src/theme/registry.spec.ts
@@ -1,6 +1,6 @@
import { join } from 'node:path';
import { readFileSync } from 'node:fs';
-import type { ThemeDefinition } from './types';
+import type { IThemeRGB, ThemeDefinition } from './types';
import {
collectThemeWarnings,
darkAppearanceDefaults,
@@ -644,12 +644,12 @@ describe('theme registry', () => {
expect(resolved.colors['rgb-alert-error-border']).toBe('7 8 9');
});
- it('keeps the category icons on the series slot a theme repainted, unless it names them', () => {
+ it('keeps the category icons on the series slots a theme repainted, unless it names them', () => {
const inherited = resolveTheme(
{
version: 1,
name: 'legacy-series',
- modes: { light: { colors: { 'rgb-series-4': '4 5 6' } } },
+ modes: { light: { colors: { 'rgb-series-2': '1 2 3', 'rgb-series-4': '4 5 6' } } },
},
'light',
);
@@ -657,16 +657,54 @@ describe('theme registry', () => {
{
version: 1,
name: 'explicit-category-icon',
- modes: { light: { colors: { 'rgb-series-4': '4 5 6', 'rgb-category-icon': '7 8 9' } } },
+ modes: { light: { colors: { 'rgb-series-4': '4 5 6', 'rgb-category-icon-4': '7 8 9' } } },
},
'light',
);
- expect(inherited.colors['rgb-category-icon']).toBe('4 5 6');
- expect(explicit.colors['rgb-category-icon']).toBe('7 8 9');
+ expect(inherited.colors['rgb-category-icon-2']).toBe('1 2 3');
+ expect(inherited.colors['rgb-category-icon-4']).toBe('4 5 6');
+ expect(explicit.colors['rgb-category-icon-4']).toBe('7 8 9');
expect(explicit.colors['rgb-series-4']).toBe('4 5 6');
});
+ it('carries the slot 4 category icon from the role name it first shipped under', () => {
+ const legacy = { 'rgb-series-4': '4 5 6', 'rgb-category-icon': '7 8 9' } as IThemeRGB;
+ const renamed = resolveTheme(
+ { version: 1, name: 'renamed-category-icon', modes: { light: { colors: legacy } } },
+ 'light',
+ );
+ const named = resolveTheme(
+ {
+ version: 1,
+ name: 'current-category-icon',
+ modes: { light: { colors: { ...legacy, 'rgb-category-icon-4': '1 2 3' } } },
+ },
+ 'light',
+ );
+
+ expect(renamed.colors['rgb-category-icon-4']).toBe('7 8 9');
+ expect(named.colors['rgb-category-icon-4']).toBe('1 2 3');
+ expect(renamed.colors).not.toHaveProperty('rgb-category-icon');
+ });
+
+ it('keeps a renamed category icon role through the legacy color adapter', () => {
+ const legacy = { 'rgb-category-icon': '7 8 9' } as IThemeRGB;
+
+ expect(fromLegacyTheme(legacy).modes.light?.colors?.['rgb-category-icon-4']).toBe('7 8 9');
+ expect(fromLegacyTheme(legacy).modes.light?.colors).not.toHaveProperty('rgb-category-icon');
+ });
+
+ it('does not warn that a renamed category icon role is ignored', () => {
+ const theme = {
+ version: 1,
+ name: 'renamed-category-icon-warning',
+ modes: { light: { colors: { 'rgb-category-icon': '7 8 9' } as IThemeRGB } },
+ };
+
+ expect(collectThemeWarnings(theme)).toEqual([]);
+ });
+
it('preserves an explicit tooltip surface and falls back to the bundled one otherwise', () => {
const explicit = resolveTheme(
{
diff --git a/packages/client/src/theme/registry.ts b/packages/client/src/theme/registry.ts
index ae6ed58e1e..7340651439 100644
--- a/packages/client/src/theme/registry.ts
+++ b/packages/client/src/theme/registry.ts
@@ -6,12 +6,14 @@ import {
collectThemeWarningIssues,
defaultSwitchSize,
themeColorTokens as sharedColorTokens,
+ renamedThemeColorTokens,
themeBrandTokens as sharedBrandTokens,
} from 'librechat-data-provider';
import type {
ThemeColorToken,
ThemeBrandToken,
ThemeAppearanceToken,
+ RenamedThemeColorToken,
} from 'librechat-data-provider';
import type {
IThemeAppearance,
@@ -177,7 +179,12 @@ export const overlayFallbackSources: ReadonlyArray<readonly [keyof IThemeRGB, ke
['rgb-text-tooltip', 'rgb-text-primary'],
['rgb-alert-error-fill', 'rgb-status-error-subtle'],
['rgb-alert-error-border', 'rgb-status-error-border'],
- ['rgb-category-icon', 'rgb-series-4'],
+ ['rgb-category-icon-1', 'rgb-series-1'],
+ ['rgb-category-icon-2', 'rgb-series-2'],
+ ['rgb-category-icon-4', 'rgb-series-4'],
+ ['rgb-category-icon-5', 'rgb-series-5'],
+ ['rgb-category-icon-6', 'rgb-series-6'],
+ ['rgb-category-icon-7', 'rgb-series-7'],
];
/** A theme that repaints a source role keeps the tooltip, the error alert and the category icons on
@@ -533,13 +540,30 @@ function definedEntries<T extends object>(values?: Partial<T>): Partial<T> {
) as Partial<T>;
}
+/** Roles that shipped under another name, each paired with the name it has now. */
+export const renamedColorTokens: ReadonlyArray<readonly [RenamedThemeColorToken, keyof IThemeRGB]> =
+ renamedThemeColorTokens;
+
+/** Colors as a theme written before a rename may carry them. */
+export type RenamedThemeRGB = IThemeRGB & Partial<Record<RenamedThemeColorToken, string>>;
+
+/** Carries a renamed role to its current name, unless the colors name that too, so every reader
+ * that keeps only known tokens keeps the value. */
+export function withRenamedColors(colors: RenamedThemeRGB): IThemeRGB {
+ const renamed = renamedColorTokens.flatMap(([from, to]) => {
+ const value = colors[from];
+ return value !== undefined && colors[to] === undefined ? [[to, value] as const] : [];
+ });
+ return renamed.length > 0 ? { ...colors, ...Object.fromEntries(renamed) } : colors;
+}
+
/** A color token this reader does not know passed validation as a warning; it never reaches the DOM. */
-function knownColors(colors?: IThemeRGB): IThemeRGB | undefined {
+function knownColors(colors?: RenamedThemeRGB): IThemeRGB | undefined {
if (!colors) {
return colors;
}
return Object.fromEntries(
- Object.entries(colors).filter(([key]) => colorTokenSet.has(key)),
+ Object.entries(withRenamedColors(colors)).filter(([key]) => colorTokenSet.has(key)),
) as IThemeRGB;
}
@@ -880,10 +904,11 @@ export function resolveTheme(theme: ThemeDefinition, mode: ThemeMode): ResolvedT
};
}
-export function fromLegacyTheme(colors: IThemeRGB, name = 'custom'): ThemeDefinition {
+export function fromLegacyTheme(colors: RenamedThemeRGB, name = 'custom'): ThemeDefinition {
const legacyName = name.trim() || 'custom';
+ const current = withRenamedColors(colors);
const sanitizedColors = themeColorTokens.reduce<IThemeRGB>((result, token) => {
- const value = colors[token];
+ const value = current[token];
if (isThemeRGB(value)) {
result[token] = value;
}
diff --git a/packages/client/src/theme/semanticTokens.spec.ts b/packages/client/src/theme/semanticTokens.spec.ts
index 0b6b6333e4..ed2d07ffa5 100644
--- a/packages/client/src/theme/semanticTokens.spec.ts
+++ b/packages/client/src/theme/semanticTokens.spec.ts
@@ -921,39 +921,51 @@ describe('scrim defaults', () => {
});
});
-/** The stock and high contrast palettes keep the category icons on the series slot they drew in. */
+const categoryIconSlots = ['1', '2', '4', '5', '6', '7'] as const;
+
+/** The stock and high contrast palettes keep each category icon on the series slot it drew in. */
describe.each([
['default', defaultTheme],
['dark', darkTheme],
['high contrast light', highContrastLightTheme],
['high contrast dark', highContrastDarkTheme],
])('%s category icons', (_name, theme: IThemeRGB) => {
- it('paint in series-4', () => {
- expect(theme['rgb-category-icon']).toBe(theme['rgb-series-4']);
+ it.each(categoryIconSlots)('paint category-icon-%s in its series slot', (slot) => {
+ expect(theme[`rgb-category-icon-${slot}`]).toBe(theme[`rgb-series-${slot}`]);
});
});
-/** ClickHouse quiets the category icons apart from its chart slot, and each one is a graphical
- * object under WCAG 1.4.11, so it owes 3:1 on the panel and on a hovered or selected row. */
+/** ClickHouse draws every category icon in its muted ink, apart from the chart slots, and each one
+ * is a graphical object under WCAG 1.4.11, so it owes 3:1 on the panel and on a hovered or
+ * selected row. */
describe.each([
['clickhouse light', clickHouseLightTheme],
['clickhouse dark', clickHouseDarkTheme],
])('%s category icons', (_name, theme: IThemeRGB) => {
- it('clear the 3:1 mark floor on every row surface without moving series-4', () => {
- const icon = toRgb(theme, 'rgb-category-icon');
- const surfaces: Array<keyof IThemeRGB> = [
- 'rgb-surface-primary',
- 'rgb-surface-primary-alt',
- 'rgb-surface-nav-hover',
- 'rgb-surface-nav-selected',
- ];
+ const surfaces: Array<keyof IThemeRGB> = [
+ 'rgb-surface-primary',
+ 'rgb-surface-primary-alt',
+ 'rgb-surface-nav-hover',
+ 'rgb-surface-nav-selected',
+ ];
+
+ it.each(categoryIconSlots)(
+ 'clear the 3:1 mark floor for category-icon-%s on every row surface',
+ (slot) => {
+ const icon = toRgb(theme, `rgb-category-icon-${slot}`);
+ const failures = surfaces.flatMap((surface) => {
+ const ratio = contrast(icon, toRgb(theme, surface));
+ return ratio < WCAG_MARK_MIN ? [`${surface}: ${ratio.toFixed(2)}:1`] : [];
+ });
- const failures = surfaces.flatMap((surface) => {
- const ratio = contrast(icon, toRgb(theme, surface));
- return ratio < WCAG_MARK_MIN ? [`${surface}: ${ratio.toFixed(2)}:1`] : [];
- });
+ expect(failures).toEqual([]);
+ },
+ );
- expect(failures).toEqual([]);
- expect(theme['rgb-category-icon']).not.toBe(theme['rgb-series-4']);
+ it('draw every category in the muted ink without moving the series slots', () => {
+ categoryIconSlots.forEach((slot) => {
+ expect(theme[`rgb-category-icon-${slot}`]).toBe(theme['rgb-text-secondary']);
+ expect(theme[`rgb-series-${slot}`]).not.toBe(theme['rgb-text-secondary']);
+ });
});
});
diff --git a/packages/client/src/theme/themes/clickhouse.ts b/packages/client/src/theme/themes/clickhouse.ts
index b055233988..9343b02973 100644
--- a/packages/client/src/theme/themes/clickhouse.ts
+++ b/packages/client/src/theme/themes/clickhouse.ts
@@ -208,7 +208,12 @@ export const clickHouseLightTheme: IThemeRGB = {
'rgb-series-6': '187 51 255', // #bb33ff (chart.default.violet)
'rgb-series-7': '0 203 235', // #00cbeb (chart.default.babyblue)
'rgb-series-8': '8 155 131', // #089b83 (chart.default.teal)
- 'rgb-category-icon': '105 110 121', // #696e79 (text.muted; Click UI draws its icons neutral)
+ 'rgb-category-icon-1': '105 110 121', // #696e79 (text.muted; Click UI draws its icons neutral)
+ 'rgb-category-icon-2': '105 110 121', // #696e79 (text.muted)
+ 'rgb-category-icon-4': '105 110 121', // #696e79 (text.muted)
+ 'rgb-category-icon-5': '105 110 121', // #696e79 (text.muted)
+ 'rgb-category-icon-6': '105 110 121', // #696e79 (text.muted)
+ 'rgb-category-icon-7': '105 110 121', // #696e79 (text.muted)
// Switch
'rgb-switch-unchecked': '204 207 211', // #cccfd3 (switch.color.background.default)
@@ -400,7 +405,12 @@ export const clickHouseDarkTheme: IThemeRGB = {
'rgb-series-6': '187 51 255', // #bb33ff (chart.default.violet)
'rgb-series-7': '0 203 235', // #00cbeb (chart.default.babyblue)
'rgb-series-8': '109 248 225', // #6df8e1 (chart.default.teal)
- 'rgb-category-icon': '179 182 189', // #b3b6bd (text.muted; Click UI draws its icons neutral)
+ 'rgb-category-icon-1': '179 182 189', // #b3b6bd (text.muted; Click UI draws its icons neutral)
+ 'rgb-category-icon-2': '179 182 189', // #b3b6bd (text.muted)
+ 'rgb-category-icon-4': '179 182 189', // #b3b6bd (text.muted)
+ 'rgb-category-icon-5': '179 182 189', // #b3b6bd (text.muted)
+ 'rgb-category-icon-6': '179 182 189', // #b3b6bd (text.muted)
+ 'rgb-category-icon-7': '179 182 189', // #b3b6bd (text.muted)
// Switch
'rgb-switch-unchecked': '96 96 96', // #606060 (switch.color.background.default)
diff --git a/packages/client/src/theme/themes/clickui.spec.ts b/packages/client/src/theme/themes/clickui.spec.ts
index 3a0478ae3d..b9c2b31c11 100644
--- a/packages/client/src/theme/themes/clickui.spec.ts
+++ b/packages/client/src/theme/themes/clickui.spec.ts
@@ -206,7 +206,12 @@ const colorSources: Record<ThemeMode, Partial<Record<keyof IThemeRGB, string>>>
'rgb-series-6': 'global.color.chart.default.violet',
'rgb-series-7': 'global.color.chart.default.babyblue',
'rgb-series-8': 'global.color.chart.default.teal',
- 'rgb-category-icon': 'global.color.text.muted',
+ 'rgb-category-icon-1': 'global.color.text.muted',
+ 'rgb-category-icon-2': 'global.color.text.muted',
+ 'rgb-category-icon-4': 'global.color.text.muted',
+ 'rgb-category-icon-5': 'global.color.text.muted',
+ 'rgb-category-icon-6': 'global.color.text.muted',
+ 'rgb-category-icon-7': 'global.color.text.muted',
'rgb-switch-unchecked': 'click.switch.color.background.default',
'rgb-switch-thumb': 'click.switch.color.indicator.default',
'rgb-table-header-text': 'click.table.header.color.title.default',
@@ -366,7 +371,12 @@ const colorSources: Record<ThemeMode, Partial<Record<keyof IThemeRGB, string>>>
'rgb-series-6': 'global.color.chart.default.violet',
'rgb-series-7': 'global.color.chart.default.babyblue',
'rgb-series-8': 'global.color.chart.default.teal',
- 'rgb-category-icon': 'global.color.text.muted',
+ 'rgb-category-icon-1': 'global.color.text.muted',
+ 'rgb-category-icon-2': 'global.color.text.muted',
+ 'rgb-category-icon-4': 'global.color.text.muted',
+ 'rgb-category-icon-5': 'global.color.text.muted',
+ 'rgb-category-icon-6': 'global.color.text.muted',
+ 'rgb-category-icon-7': 'global.color.text.muted',
'rgb-switch-unchecked': 'click.switch.color.background.default',
'rgb-switch-thumb': 'click.switch.color.indicator.default',
'rgb-table-header-text': 'click.table.header.color.title.default',
diff --git a/packages/client/src/theme/themes/dark.ts b/packages/client/src/theme/themes/dark.ts
index 8a4c1f9249..ec9b84a1bb 100644
--- a/packages/client/src/theme/themes/dark.ts
+++ b/packages/client/src/theme/themes/dark.ts
@@ -204,7 +204,12 @@ export const darkTheme: IThemeRGB = {
'rgb-series-6': '171 104 254', // #ab68fe (violet)
'rgb-series-7': '80 167 49', // #50a731 (green)
'rgb-series-8': '120 130 190', // #8082be (indigo)
- 'rgb-category-icon': '200 133 12', // #c8850c (matching series-4)
+ 'rgb-category-icon-1': '9 140 238', // #098cee (matching series-1)
+ 'rgb-category-icon-2': '217 87 35', // #d95723 (matching series-2)
+ 'rgb-category-icon-4': '200 133 12', // #c8850c (matching series-4)
+ 'rgb-category-icon-5': '213 82 130', // #d55282 (matching series-5)
+ 'rgb-category-icon-6': '171 104 254', // #ab68fe (matching series-6)
+ 'rgb-category-icon-7': '80 167 49', // #50a731 (matching series-7)
/** Unchecked switch track. 3.38:1 against the page and the `surface-primary`
* thumb, 5.74:1 against the checked `surface-inverted` track. */
diff --git a/packages/client/src/theme/themes/default.ts b/packages/client/src/theme/themes/default.ts
index 62b8e99b6c..60d2c2ce32 100644
--- a/packages/client/src/theme/themes/default.ts
+++ b/packages/client/src/theme/themes/default.ts
@@ -188,7 +188,12 @@ export const defaultTheme: IThemeRGB = {
'rgb-series-6': '126 35 205', // #7e23cd (violet)
'rgb-series-7': '1 131 1', // #018301 (green)
'rgb-series-8': '63 81 181', // #3f51b5 (indigo)
- 'rgb-category-icon': '182 123 5', // #b67b05 (matching series-4)
+ 'rgb-category-icon-1': '5 110 189', // #056ebd (matching series-1)
+ 'rgb-category-icon-2': '233 86 13', // #e9560d (matching series-2)
+ 'rgb-category-icon-4': '182 123 5', // #b67b05 (matching series-4)
+ 'rgb-category-icon-5': '216 90 142', // #d85a8e (matching series-5)
+ 'rgb-category-icon-6': '126 35 205', // #7e23cd (matching series-6)
+ 'rgb-category-icon-7': '1 131 1', // #018301 (matching series-7)
/** Unchecked switch track. 3.03:1 against the white page and the
* `surface-primary` thumb, 5.91:1 against the checked `surface-inverted`
diff --git a/packages/client/src/theme/themes/highContrast.ts b/packages/client/src/theme/themes/highContrast.ts
index 32e4d9ea0a..1505b7437a 100644
--- a/packages/client/src/theme/themes/highContrast.ts
+++ b/packages/client/src/theme/themes/highContrast.ts
@@ -226,7 +226,12 @@ export const highContrastLightTheme: IThemeRGB = {
'rgb-series-6': '77 26 153', // #4d1a99
'rgb-series-7': '15 92 15', // #0f5c0f
'rgb-series-8': '0 0 0', // #000000 (neutral text stop)
- 'rgb-category-icon': '92 74 0', // #5c4a00 (matching series-4)
+ 'rgb-category-icon-1': '11 79 160', // #0b4fa0 (matching series-1)
+ 'rgb-category-icon-2': '143 59 0', // #8f3b00 (matching series-2)
+ 'rgb-category-icon-4': '92 74 0', // #5c4a00 (matching series-4)
+ 'rgb-category-icon-5': '148 0 92', // #94005c (matching series-5)
+ 'rgb-category-icon-6': '77 26 153', // #4d1a99 (matching series-6)
+ 'rgb-category-icon-7': '15 92 15', // #0f5c0f (matching series-7)
/** Unchecked switch track. The stock 58%/40% greys land at 2.9:1 and 2.2:1
* against these canvases. This clears 3:1 three ways at once: 5.74:1 against
@@ -437,7 +442,12 @@ export const highContrastDarkTheme: IThemeRGB = {
'rgb-series-6': '200 163 255', // #c8a3ff
'rgb-series-7': '140 230 140', // #8ce68c
'rgb-series-8': '255 255 255', // #ffffff (neutral text stop)
- 'rgb-category-icon': '255 224 102', // #ffe066 (matching series-4)
+ 'rgb-category-icon-1': '107 184 255', // #6bb8ff (matching series-1)
+ 'rgb-category-icon-2': '255 179 102', // #ffb366 (matching series-2)
+ 'rgb-category-icon-4': '255 224 102', // #ffe066 (matching series-4)
+ 'rgb-category-icon-5': '255 153 194', // #ff99c2 (matching series-5)
+ 'rgb-category-icon-6': '200 163 255', // #c8a3ff (matching series-6)
+ 'rgb-category-icon-7': '140 230 140', // #8ce68c (matching series-7)
/** Unchecked switch track: 5.32:1 against the page and the `surface-primary`
* thumb, 3.95:1 against the checked `surface-inverted` track. */
diff --git a/packages/client/src/theme/tokens.css b/packages/client/src/theme/tokens.css
index 5e39329b5e..0cd6d019b6 100644
--- a/packages/client/src/theme/tokens.css
+++ b/packages/client/src/theme/tokens.css
@@ -202,8 +202,13 @@
--color-series-6: rgb(var(--series-6));
--color-series-7: rgb(var(--series-7));
--color-series-8: rgb(var(--series-8));
- /* Follows the slot it was painted in before its role, for a stylesheet that predates it. */
- --color-category-icon: rgb(var(--category-icon, var(--series-4)));
+ /* Each follows the slot it was painted in before its role, for a stylesheet that predates it. */
+ --color-category-icon-1: rgb(var(--category-icon-1, var(--series-1)));
+ --color-category-icon-2: rgb(var(--category-icon-2, var(--series-2)));
+ --color-category-icon-4: rgb(var(--category-icon-4, var(--series-4)));
+ --color-category-icon-5: rgb(var(--category-icon-5, var(--series-5)));
+ --color-category-icon-6: rgb(var(--category-icon-6, var(--series-6)));
+ --color-category-icon-7: rgb(var(--category-icon-7, var(--series-7)));
/* charts and controls */
--color-chart-widget-surface: rgb(var(--chart-widget-surface));
diff --git a/packages/client/src/theme/types/index.ts b/packages/client/src/theme/types/index.ts
index 2a60656672..ff44e22f19 100644
--- a/packages/client/src/theme/types/index.ts
+++ b/packages/client/src/theme/types/index.ts
@@ -246,9 +246,17 @@ export interface IThemeRGB {
'rgb-series-6'?: string;
'rgb-series-7'?: string;
'rgb-series-8'?: string;
- /** The prompt category icons drawn in `rgb-series-4` (idea, travel, aftersales); it follows
- * `rgb-series-4` when a theme omits it, so a theme can quiet them without moving the chart slot. */
- 'rgb-category-icon'?: string;
+ /**
+ * The prompt category icons, one role per series slot they were drawn in. Each follows its
+ * `rgb-series-N` when a theme omits it, so a theme can quiet the icons without moving the
+ * chart slots they share.
+ */
+ 'rgb-category-icon-1'?: string;
+ 'rgb-category-icon-2'?: string;
+ 'rgb-category-icon-4'?: string;
+ 'rgb-category-icon-5'?: string;
+ 'rgb-category-icon-6'?: string;
+ 'rgb-category-icon-7'?: string;
/**
* Unchecked track of the shared `Switch`. A control state rather than a
@@ -435,7 +443,12 @@ export interface IThemeVariables {
'--series-6': string;
'--series-7': string;
'--series-8': string;
- '--category-icon': string;
+ '--category-icon-1': string;
+ '--category-icon-2': string;
+ '--category-icon-4': string;
+ '--category-icon-5': string;
+ '--category-icon-6': string;
+ '--category-icon-7': string;
'--switch-unchecked': string;
'--switch-thumb': string;
@@ -601,7 +614,12 @@ export interface IThemeColors {
'table-header-text'?: string;
'table-header-fill'?: string;
'series-8'?: string;
- 'category-icon'?: string;
+ 'category-icon-1'?: string;
+ 'category-icon-2'?: string;
+ 'category-icon-4'?: string;
+ 'category-icon-5'?: string;
+ 'category-icon-6'?: string;
+ 'category-icon-7'?: string;
presentation?: string;
// Retained for excluded SidePanel/Agents + SidePanel/Builder (pending migration)
diff --git a/packages/client/src/theme/utils/applyTheme.spec.ts b/packages/client/src/theme/utils/applyTheme.spec.ts
index 3b13c344c3..bfb84ae3ca 100644
--- a/packages/client/src/theme/utils/applyTheme.spec.ts
+++ b/packages/client/src/theme/utils/applyTheme.spec.ts
@@ -1,4 +1,4 @@
-import type { ThemeDefinition } from '../types';
+import type { IThemeRGB, ThemeDefinition } from '../types';
import applyTheme, {
applyResolvedTheme,
clearAppliedTheme,
@@ -75,6 +75,12 @@ describe('applyTheme', () => {
);
});
+ it('writes a renamed category icon role from legacy colors to its slot 4 name', () => {
+ applyTheme({ 'rgb-category-icon': '7 8 9' } as IThemeRGB);
+
+ expect(document.documentElement.style.getPropertyValue('--category-icon-4')).toBe('7 8 9');
+ });
+
it('keeps existing custom hover colors on composer controls', () => {
applyTheme({
'rgb-surface-hover': '44 45 46',
diff --git a/packages/client/src/theme/utils/applyTheme.ts b/packages/client/src/theme/utils/applyTheme.ts
index c3dc3ae536..3fce3fcce5 100644
--- a/packages/client/src/theme/utils/applyTheme.ts
+++ b/packages/client/src/theme/utils/applyTheme.ts
@@ -1,4 +1,5 @@
import type { IThemeAppearance, IThemeBrands, IThemeRGB, ResolvedThemeDefinition } from '../types';
+import type { RenamedThemeRGB } from '../registry';
import {
controlBorderFallback,
focusFallbacks,
@@ -11,6 +12,7 @@ import {
themeAppearanceProperties,
themeBrandTokens,
themeColorTokens,
+ withRenamedColors,
} from '../registry';
const colorProperty = (token: keyof IThemeRGB): `--${string}` => `--${token.slice(4)}`;
@@ -32,7 +34,8 @@ function validateRGB(rgb: string): boolean {
/** `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]> {
+function mapColors(input: RenamedThemeRGB, base?: IThemeRGB): Array<[string, string]> {
+ const colors = withRenamedColors(input);
const variables = themeColorTokens.reduce<Array<[string, string]>>((result, token) => {
const value = colors[token];
if (value !== undefined) {
diff --git a/packages/data-provider/src/theme.ts b/packages/data-provider/src/theme.ts
index d703fe1241..6d5dd4bcba 100644
--- a/packages/data-provider/src/theme.ts
+++ b/packages/data-provider/src/theme.ts
@@ -171,7 +171,12 @@ export const themeColorTokens = Object.freeze([
'rgb-series-6',
'rgb-series-7',
'rgb-series-8',
- 'rgb-category-icon',
+ 'rgb-category-icon-1',
+ 'rgb-category-icon-2',
+ 'rgb-category-icon-4',
+ 'rgb-category-icon-5',
+ 'rgb-category-icon-6',
+ 'rgb-category-icon-7',
'rgb-switch-unchecked',
'rgb-switch-thumb',
'rgb-table-header-text',
@@ -181,6 +186,14 @@ export const themeColorTokens = Object.freeze([
export type ThemeColorToken = (typeof themeColorTokens)[number];
+/** Role names a release shipped and a later one renamed. */
+export type RenamedThemeColorToken = 'rgb-category-icon';
+
+/** Each renamed role paired with the name it has now; readers carry a value to the current name. */
+export const renamedThemeColorTokens: ReadonlyArray<
+ readonly [RenamedThemeColorToken, ThemeColorToken]
+> = Object.freeze([['rgb-category-icon', 'rgb-category-icon-4']] as const);
+
export const themeBrandTokens = Object.freeze([
'provider-openai',
'provider-openai-gpt4',
@@ -566,6 +579,9 @@ export const isThemeAppearanceToken = (key: string): key is ThemeAppearanceToken
Object.prototype.hasOwnProperty.call(appearanceValidators, key);
const colorTokenSet: ReadonlySet<string> = new Set<string>(themeColorTokens);
+const renamedColorTokenSet: ReadonlySet<string> = new Set<string>(
+ renamedThemeColorTokens.map(([from]) => from),
+);
const brandTokenSet: ReadonlySet<string> = new Set<string>(themeBrandTokens);
const themeModes = ['light', 'dark'] as const;
@@ -661,7 +677,11 @@ export function collectThemeWarningIssues(theme: unknown): ThemeIssue[] {
const futureColors = isPlainThemeRecord(colors)
? Object.entries(colors)
.filter(
- ([key, value]) => !colorTokenSet.has(key) && isColorTokenName(key) && isThemeRGB(value),
+ ([key, value]) =>
+ !colorTokenSet.has(key) &&
+ !renamedColorTokenSet.has(key) &&
+ isColorTokenName(key) &&
+ isThemeRGB(value),
)
.map(([key]) =>
issue(['modes', mode, 'colors', key], `Unknown ${mode} color token ignored: ${key}`),