mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-11-16 21:08:17 +00:00
🎨 feat: Theme the Shared Code Block With surface-code and a New surface-code-body Role (#16334)
This commit is contained in:
parent
e79ed0ab37
commit
ecce519b68
17 changed files with 257 additions and 16 deletions
|
|
@ -16,13 +16,13 @@ const CodeBar: React.FC<CodeBarProps> = React.memo(
|
|||
const { isDownloaded, handleDownload } = useDownloadCode(codeRef, lang);
|
||||
|
||||
return (
|
||||
<div className="flex items-center justify-between bg-surface-primary-alt px-1.5 py-1.5 font-sans text-xs text-text-secondary dark:bg-transparent [.user-turn_&]:bg-surface-code">
|
||||
<div className="bg-surface-code text-text-secondary flex items-center justify-between px-1.5 py-1.5 font-sans text-xs">
|
||||
<span className="flex items-center gap-1.5 text-xs font-medium">
|
||||
<LangIcon lang={lang} className="size-3.5" />
|
||||
{lang}
|
||||
</span>
|
||||
{plugin === true ? (
|
||||
<InfoIcon className="ml-auto flex h-4 w-4 gap-2 text-text-secondary" />
|
||||
<InfoIcon className="text-text-secondary ml-auto flex h-4 w-4 gap-2" />
|
||||
) : (
|
||||
<div className="flex items-center justify-center gap-2">
|
||||
{allowExecution === true && (
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ const CodeBlock: React.FC<CodeBlockProps> = ({
|
|||
return (
|
||||
<div
|
||||
ref={containerRef}
|
||||
className="relative w-full overflow-hidden rounded-xl border border-border-light text-xs"
|
||||
className="border-border-light relative w-full overflow-hidden rounded-xl border text-xs"
|
||||
onMouseEnter={handleMouseEnter}
|
||||
onMouseLeave={handleMouseLeave}
|
||||
onFocus={handleFocus}
|
||||
|
|
@ -117,9 +117,7 @@ const CodeBlock: React.FC<CodeBlockProps> = ({
|
|||
allowExecution={allowExecution}
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
className={cn(classProp, 'overflow-y-auto bg-surface-chat p-4 dark:bg-surface-primary-alt')}
|
||||
>
|
||||
<div className={cn(classProp, 'bg-surface-code-body overflow-y-auto p-4')}>
|
||||
<code
|
||||
ref={codeRef}
|
||||
className={cn(
|
||||
|
|
@ -140,11 +138,11 @@ const CodeBlock: React.FC<CodeBlockProps> = ({
|
|||
/>
|
||||
{allowExecution === true && toolCalls && toolCalls.length > 0 && (
|
||||
<>
|
||||
<div className="border-t border-border-light bg-surface-primary-alt p-4 text-xs dark:bg-transparent [.user-turn_&]:bg-surface-code">
|
||||
<div className="mb-1 text-[10px] font-medium uppercase tracking-wide text-text-secondary">
|
||||
<div className="border-border-light bg-surface-code border-t p-4 text-xs">
|
||||
<div className="text-text-secondary mb-1 text-[10px] font-medium tracking-wide uppercase">
|
||||
{localize('com_ui_output')}
|
||||
</div>
|
||||
<div className="flex flex-col-reverse text-text-primary">
|
||||
<div className="text-text-primary flex flex-col-reverse">
|
||||
<pre className="shrink-0">
|
||||
<LogContent
|
||||
output={(currentToolCall?.result as string | undefined) ?? ''}
|
||||
|
|
|
|||
|
|
@ -26,18 +26,18 @@ export default function ResultSwitcher({
|
|||
return (
|
||||
<nav
|
||||
aria-label={localize('com_ui_navigate_results')}
|
||||
className="flex items-center justify-center gap-1.5 border-t border-border-light px-3 py-1.5 text-xs [.user-turn_&]:bg-surface-code"
|
||||
className="border-border-light bg-surface-code flex items-center justify-center gap-1.5 border-t px-3 py-1.5 text-xs"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
onClick={onPrevious}
|
||||
disabled={atFirst}
|
||||
aria-label={localize('com_ui_prev_result')}
|
||||
className="rounded p-0.5 text-text-tertiary transition-colors hover:bg-surface-hover hover:text-text-primary focus:outline focus:outline-2 focus:outline-border-heavy disabled:pointer-events-none disabled:opacity-30"
|
||||
className="text-text-tertiary hover:bg-surface-hover hover:text-text-primary focus:outline-border-heavy rounded p-0.5 transition-colors focus:outline focus:outline-2 disabled:pointer-events-none disabled:opacity-30"
|
||||
>
|
||||
<ChevronLeft className="size-3.5" aria-hidden="true" />
|
||||
</button>
|
||||
<span className="min-w-[3ch] select-none text-center tabular-nums text-text-secondary">
|
||||
<span className="text-text-secondary min-w-[3ch] text-center tabular-nums select-none">
|
||||
{currentIndex + 1}/{totalCount}
|
||||
</span>
|
||||
<button
|
||||
|
|
@ -45,7 +45,7 @@ export default function ResultSwitcher({
|
|||
onClick={onNext}
|
||||
disabled={atLast}
|
||||
aria-label={localize('com_ui_next_result')}
|
||||
className="rounded p-0.5 text-text-tertiary transition-colors hover:bg-surface-hover hover:text-text-primary focus:outline focus:outline-2 focus:outline-border-heavy disabled:pointer-events-none disabled:opacity-30"
|
||||
className="text-text-tertiary hover:bg-surface-hover hover:text-text-primary focus:outline-border-heavy rounded p-0.5 transition-colors focus:outline focus:outline-2 disabled:pointer-events-none disabled:opacity-30"
|
||||
>
|
||||
<ChevronRight className="size-3.5" aria-hidden="true" />
|
||||
</button>
|
||||
|
|
|
|||
|
|
@ -220,6 +220,7 @@ html {
|
|||
--surface-destructive-hover: var(--red-800);
|
||||
--surface-chat: var(--white);
|
||||
--surface-code: var(--surface-primary-alt);
|
||||
--surface-code-body: var(--surface-chat);
|
||||
--surface-qr: var(--white);
|
||||
--border-light: var(--gray-200);
|
||||
--border-light-alpha: 1;
|
||||
|
|
@ -344,6 +345,7 @@ html {
|
|||
--surface-destructive-hover: var(--red-900);
|
||||
--surface-chat: var(--gray-700);
|
||||
--surface-code: var(--presentation);
|
||||
--surface-code-body: var(--surface-primary-alt);
|
||||
--surface-qr: var(--white);
|
||||
--border-light: var(--gray-700);
|
||||
--border-medium-alt: var(--gray-600);
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ import {
|
|||
withMongo,
|
||||
} from '../db';
|
||||
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 { openAgentBuilder, uniqueAgentName, cleanupAgent } from '../agents.helpers';
|
||||
import { MOCK_ENDPOINTS, getAccessToken, requestJson } from '../helpers';
|
||||
import { getE2EUser } from '../../../setup/user';
|
||||
|
|
@ -155,6 +157,86 @@ async function seedCodeAnalysis(title: string, logs?: string): Promise<string> {
|
|||
return conversationId;
|
||||
}
|
||||
|
||||
async function seedCodeReply(title: string, runs: string[] = []): Promise<string> {
|
||||
const conversationId = randomUUID();
|
||||
const { email } = getE2EUser();
|
||||
await seedConversations(email, [{ conversationId, title, updatedAt: new Date() }]);
|
||||
await withMongo(async (db) => {
|
||||
const user = await db.collection('users').findOne({ email });
|
||||
const userId = String(user?._id);
|
||||
const userMessageId = randomUUID();
|
||||
const replyId = randomUUID();
|
||||
const now = Date.now();
|
||||
await db.collection('messages').insertMany([
|
||||
{
|
||||
messageId: userMessageId,
|
||||
parentMessageId: '00000000-0000-0000-0000-000000000000',
|
||||
conversationId,
|
||||
user: userId,
|
||||
endpoint: 'agents',
|
||||
text: 'Show me the snippet',
|
||||
isCreatedByUser: true,
|
||||
sender: 'User',
|
||||
error: false,
|
||||
unfinished: false,
|
||||
createdAt: new Date(now),
|
||||
updatedAt: new Date(now),
|
||||
__v: 0,
|
||||
},
|
||||
{
|
||||
messageId: replyId,
|
||||
parentMessageId: userMessageId,
|
||||
conversationId,
|
||||
user: userId,
|
||||
endpoint: 'agents',
|
||||
text: '',
|
||||
isCreatedByUser: false,
|
||||
sender: 'Mock Provider A',
|
||||
error: false,
|
||||
unfinished: false,
|
||||
content: [{ type: 'text', text: `Here it is:\n\n\`\`\`python\n${CODE_INPUT}\n\`\`\`` }],
|
||||
createdAt: new Date(now + 1000),
|
||||
updatedAt: new Date(now + 1000),
|
||||
__v: 0,
|
||||
},
|
||||
]);
|
||||
if (runs.length === 0) {
|
||||
return;
|
||||
}
|
||||
await db.collection('toolcalls').insertMany(
|
||||
runs.map((result, i) => ({
|
||||
conversationId,
|
||||
messageId: replyId,
|
||||
toolId: 'execute_code',
|
||||
user: user?._id,
|
||||
result,
|
||||
partIndex: 0,
|
||||
blockIndex: 0,
|
||||
createdAt: new Date(now + 2000 + i),
|
||||
updatedAt: new Date(now + 2000 + i),
|
||||
})),
|
||||
);
|
||||
});
|
||||
return conversationId;
|
||||
}
|
||||
|
||||
/** Reads the shared code block's toolbar (`surface-code`) and code pane (`surface-code-body`). */
|
||||
async function expectCodePanePaint(block: Locator, colors: IThemeRGB) {
|
||||
const surface = rgbCss(colors['rgb-surface-code']);
|
||||
const body = rgbCss(colors['rgb-surface-code-body']);
|
||||
const code = block.locator('code').first();
|
||||
await expect(code).toBeVisible();
|
||||
const pane = code.locator('xpath=..');
|
||||
const toolbar = block.getByText('python', { exact: true }).first().locator('xpath=..');
|
||||
expect((await painted(toolbar)).background).toBe(surface);
|
||||
const panePaint = await painted(pane);
|
||||
expect(panePaint.background).toBe(body);
|
||||
const codeColor = (await painted(code)).color;
|
||||
expect(contrast(parseRgb(codeColor), parseRgb(panePaint.background))).toBeGreaterThan(
|
||||
WCAG_AA_NORMAL,
|
||||
);
|
||||
}
|
||||
|
||||
async function openCodeAnalysis(page: Page, conversationId: string, mode: Mode) {
|
||||
await page.goto(`/c/${conversationId}?${THEME_PARAM}=${mode}`);
|
||||
await expect(page.locator('html')).toHaveClass(new RegExp(`\\b${mode}\\b`));
|
||||
|
|
@ -247,6 +329,7 @@ test.describe('semantic colour roles on builder, tools and sharing surfaces', ()
|
|||
const colors = colorsFor(mode);
|
||||
const block = await openCodeAnalysis(page, conversationId, mode);
|
||||
expect((await painted(block)).background).toBe(rgbCss(colors['rgb-surface-code']));
|
||||
await expectCodePanePaint(block, colors);
|
||||
|
||||
const output = block.getByText(CODE_LOGS, { exact: true });
|
||||
await expect(output).toBeVisible();
|
||||
|
|
@ -266,6 +349,96 @@ test.describe('semantic colour roles on builder, tools and sharing surfaces', ()
|
|||
}
|
||||
});
|
||||
|
||||
test('a chat code block paints its toolbar and code pane with the theme code surface @scenario:chat-code-block-follows-theme-code-surface', async ({
|
||||
page,
|
||||
}) => {
|
||||
test.setTimeout(90000);
|
||||
const conversationId = await seedCodeReply('Theme chat code block');
|
||||
await installThemeBridge(page);
|
||||
|
||||
try {
|
||||
for (const mode of MODES) {
|
||||
await page.goto(`/c/${conversationId}?${THEME_PARAM}=${mode}`);
|
||||
await expect(page.locator('html')).toHaveClass(new RegExp(`\\b${mode}\\b`));
|
||||
const code = page.locator('.message-render code', { hasText: CODE_INPUT }).first();
|
||||
await expect(code).toBeVisible({ timeout: 20000 });
|
||||
const block = code.locator('xpath=ancestor::div[contains(@class,"rounded-xl")][1]');
|
||||
await expectCodePanePaint(block, colorsFor(mode));
|
||||
}
|
||||
} finally {
|
||||
await deleteMessagesByConversation([conversationId]);
|
||||
await deleteConversations([conversationId]);
|
||||
}
|
||||
});
|
||||
|
||||
test('the built-in theme keeps the code pane distinct from its toolbar @scenario:chat-code-block-keeps-default-pane', async ({
|
||||
page,
|
||||
}) => {
|
||||
test.setTimeout(90000);
|
||||
const conversationId = await seedCodeReply('Default chat code block');
|
||||
|
||||
try {
|
||||
for (const mode of MODES) {
|
||||
await page.addInitScript((m) => {
|
||||
localStorage.setItem('color-theme', m);
|
||||
localStorage.removeItem('theme-definition');
|
||||
localStorage.removeItem('theme-source');
|
||||
localStorage.removeItem('theme-colors');
|
||||
localStorage.removeItem('theme-name');
|
||||
}, mode);
|
||||
await page.goto(`/c/${conversationId}`);
|
||||
await expect(page.locator('html')).toHaveClass(new RegExp(`\\b${mode}\\b`));
|
||||
const code = page.locator('.message-render code', { hasText: CODE_INPUT }).first();
|
||||
await expect(code).toBeVisible({ timeout: 20000 });
|
||||
const block = code.locator('xpath=ancestor::div[contains(@class,"rounded-xl")][1]');
|
||||
await expectCodePanePaint(block, mode === 'dark' ? darkTheme : defaultTheme);
|
||||
const pane = (await painted(code.locator('xpath=..'))).background;
|
||||
const toolbar = (
|
||||
await painted(block.getByText('python', { exact: true }).first().locator('xpath=..'))
|
||||
).background;
|
||||
expect(pane).not.toBe(toolbar);
|
||||
}
|
||||
} finally {
|
||||
await deleteMessagesByConversation([conversationId]);
|
||||
await deleteConversations([conversationId]);
|
||||
}
|
||||
});
|
||||
|
||||
test('an executed chat code block paints its output pane and result switcher with the theme code surface @scenario:executed-code-block-output-follows-theme-code-surface', async ({
|
||||
page,
|
||||
}) => {
|
||||
test.setTimeout(90000);
|
||||
const conversationId = await seedCodeReply('Theme executed code block', [
|
||||
'first-run-output',
|
||||
'second-run-output',
|
||||
]);
|
||||
await installThemeBridge(page);
|
||||
|
||||
try {
|
||||
for (const mode of MODES) {
|
||||
await page.goto(`/c/${conversationId}?${THEME_PARAM}=${mode}`);
|
||||
await expect(page.locator('html')).toHaveClass(new RegExp(`\\b${mode}\\b`));
|
||||
const surface = rgbCss(colorsFor(mode)['rgb-surface-code']);
|
||||
const switcher = page.getByRole('navigation', { name: 'Navigate results' });
|
||||
await expect(switcher).toBeVisible({ timeout: 20000 });
|
||||
expect((await painted(switcher)).background).toBe(surface);
|
||||
|
||||
const output = page.getByText(/^(first|second)-run-output$/);
|
||||
await expect(output).toBeVisible();
|
||||
const pane = page.getByText('Output', { exact: true }).locator('xpath=..');
|
||||
const panePaint = await painted(pane);
|
||||
expect(panePaint.background).toBe(surface);
|
||||
expect(
|
||||
contrast(parseRgb((await painted(output)).color), parseRgb(panePaint.background)),
|
||||
).toBeGreaterThan(WCAG_AA_NORMAL);
|
||||
}
|
||||
} finally {
|
||||
await withMongo((db) => db.collection('toolcalls').deleteMany({ conversationId }));
|
||||
await deleteMessagesByConversation([conversationId]);
|
||||
await deleteConversations([conversationId]);
|
||||
}
|
||||
});
|
||||
|
||||
test('a code-analysis block without output shows the code alone @scenario:code-analysis-block-without-output-has-no-result-pane', async ({
|
||||
page,
|
||||
}) => {
|
||||
|
|
|
|||
|
|
@ -253,6 +253,8 @@ function MyComponent() {
|
|||
- `bg-surface-dialog` - Dialog/modal background
|
||||
- `bg-surface-overlay` - Dialog/modal scrim, adapted per theme
|
||||
- `bg-surface-chat` - Chat interface background
|
||||
- `bg-surface-code` - Code block chrome: toolbar, output and result switcher
|
||||
- `bg-surface-code-body` - Code block pane behind the highlighted code
|
||||
|
||||
### Border Colors
|
||||
|
||||
|
|
|
|||
|
|
@ -87,6 +87,44 @@ describe('theme registry', () => {
|
|||
expect(resolveTheme(theme, 'dark').colors['rgb-surface-code']).toBe('98 76 54');
|
||||
});
|
||||
|
||||
it('keeps a legacy theme code pane on the surfaces it was painted with', () => {
|
||||
const theme = fromLegacyTheme(
|
||||
{
|
||||
'rgb-surface-chat': '12 34 56',
|
||||
'rgb-surface-primary-alt': '210 211 212',
|
||||
},
|
||||
'legacy-code-body-reference',
|
||||
);
|
||||
|
||||
expect(resolveTheme(theme, 'light').colors['rgb-surface-code-body']).toBe('12 34 56');
|
||||
expect(resolveTheme(theme, 'dark').colors['rgb-surface-code-body']).toBe('210 211 212');
|
||||
});
|
||||
|
||||
it('preserves an explicit code pane instead of deriving it', () => {
|
||||
const theme: ThemeDefinition = {
|
||||
version: 1,
|
||||
name: 'explicit-code-body-reference',
|
||||
modes: {
|
||||
light: {
|
||||
colors: { 'rgb-surface-chat': '12 34 56', 'rgb-surface-code-body': '65 43 21' },
|
||||
},
|
||||
dark: {
|
||||
colors: { 'rgb-surface-primary-alt': '210 211 212', 'rgb-surface-code-body': '98 76 54' },
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
expect(resolveTheme(theme, 'light').colors['rgb-surface-code-body']).toBe('65 43 21');
|
||||
expect(resolveTheme(theme, 'dark').colors['rgb-surface-code-body']).toBe('98 76 54');
|
||||
});
|
||||
|
||||
it('paints the default code pane white in light and gray-850 in dark', () => {
|
||||
expect(resolveTheme(libreChatTheme, 'light').colors['rgb-surface-code-body']).toBe(
|
||||
'255 255 255',
|
||||
);
|
||||
expect(resolveTheme(libreChatTheme, 'dark').colors['rgb-surface-code-body']).toBe('23 23 23');
|
||||
});
|
||||
|
||||
it('keeps the bundled code surfaces unchanged for the default appearances', () => {
|
||||
expect(resolveTheme(libreChatTheme, 'light').colors['rgb-surface-code']).toBe(
|
||||
defaultTheme['rgb-surface-code'],
|
||||
|
|
|
|||
|
|
@ -377,6 +377,19 @@ export function resolveTheme(theme: ThemeDefinition, mode: ThemeMode): ResolvedT
|
|||
customColors?.['rgb-surface-code'] === undefined && codeSurfaceSource !== undefined
|
||||
? { 'rgb-surface-code': codeSurfaceSource }
|
||||
: {};
|
||||
/**
|
||||
* The code pane painted `surface-chat` in light and `surface-primary-alt` in
|
||||
* dark before it had a role, so a theme that names neither pane role keeps
|
||||
* the pane it was drawn against.
|
||||
*/
|
||||
const codeBodySource =
|
||||
mode === 'dark'
|
||||
? customColors?.['rgb-surface-primary-alt']
|
||||
: customColors?.['rgb-surface-chat'];
|
||||
const codeBodyFallback =
|
||||
customColors?.['rgb-surface-code-body'] === undefined && codeBodySource !== undefined
|
||||
? { 'rgb-surface-code-body': codeBodySource }
|
||||
: {};
|
||||
/**
|
||||
* Themes written before the shimmer stops existed cannot name them, and
|
||||
* filling the omission from the bundled base would pin their in-flight labels
|
||||
|
|
@ -458,6 +471,7 @@ export function resolveTheme(theme: ThemeDefinition, mode: ThemeMode): ResolvedT
|
|||
...baseColors,
|
||||
...customColors,
|
||||
...codeSurfaceFallback,
|
||||
...codeBodyFallback,
|
||||
...composerHoverFallback,
|
||||
...shimmerBaseFallback,
|
||||
...textMutedFallback,
|
||||
|
|
|
|||
|
|
@ -179,6 +179,7 @@ const canvasSurfaces: Array<keyof IThemeRGB> = [
|
|||
'rgb-surface-dialog',
|
||||
'rgb-surface-chat',
|
||||
'rgb-surface-code',
|
||||
'rgb-surface-code-body',
|
||||
'rgb-presentation',
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ const canvasSurfaces: Array<keyof IThemeRGB> = [
|
|||
'rgb-surface-dialog',
|
||||
'rgb-surface-chat',
|
||||
'rgb-surface-code',
|
||||
'rgb-surface-code-body',
|
||||
'rgb-presentation',
|
||||
];
|
||||
|
||||
|
|
@ -216,7 +217,9 @@ describe.each(modes)('clickhouse %s palette', (_mode, theme) => {
|
|||
});
|
||||
|
||||
it('keeps every syntax colour at WCAG AA on the code surface', () => {
|
||||
expect(below(theme, WCAG_AA_NORMAL, syntaxTokens, ['rgb-surface-code'])).toEqual([]);
|
||||
expect(
|
||||
below(theme, WCAG_AA_NORMAL, syntaxTokens, ['rgb-surface-code', 'rgb-surface-code-body']),
|
||||
).toEqual([]);
|
||||
});
|
||||
|
||||
it('keeps inverted and fixed pairs at WCAG AA', () => {
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ export const clickHouseLightTheme: IThemeRGB = {
|
|||
'rgb-surface-destructive-hover': '145 0 0', // #910000 (palette.danger.700)
|
||||
'rgb-surface-chat': '255 255 255', // #ffffff (background.default)
|
||||
'rgb-surface-code': '246 247 250', // #f6f7fa (background.muted)
|
||||
'rgb-surface-code-body': '246 247 250', // #f6f7fa (background.muted)
|
||||
'rgb-surface-inverted': '21 21 21', // #151515 (palette.neutral.900)
|
||||
'rgb-surface-inverted-hover': '50 50 50', // #323232 (palette.neutral.712)
|
||||
'rgb-text-inverted': '255 255 255', // #ffffff (palette.neutral.0)
|
||||
|
|
@ -195,6 +196,7 @@ export const clickHouseDarkTheme: IThemeRGB = {
|
|||
'rgb-surface-destructive-hover': '255 152 152', // #ff9898 (palette.danger.200)
|
||||
'rgb-surface-chat': '31 31 28', // #1f1f1c (background.default)
|
||||
'rgb-surface-code': '40 40 40', // #282828 (codeblock.darkMode.background.default)
|
||||
'rgb-surface-code-body': '40 40 40', // #282828 (codeblock.darkMode.background.default)
|
||||
'rgb-surface-inverted': '255 255 255', // #ffffff (palette.neutral.0)
|
||||
'rgb-surface-inverted-hover': '223 223 223', // #dfdfdf (palette.neutral.200)
|
||||
'rgb-text-inverted': '21 21 21', // #151515 (palette.neutral.900)
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ export const darkTheme: IThemeRGB = {
|
|||
'rgb-surface-destructive-hover': '127 29 29', // #7f1d1d (red-900)
|
||||
'rgb-surface-chat': '47 47 47', // #2f2f2f (gray-700)
|
||||
'rgb-surface-code': '33 33 33', // #212121 (gray-800)
|
||||
'rgb-surface-code-body': '23 23 23', // #171717 (gray-850)
|
||||
'rgb-surface-inverted': '255 255 255', // #fff (white)
|
||||
'rgb-surface-inverted-hover': '236 236 236', // #ececec (gray-100)
|
||||
'rgb-text-inverted': '23 23 23', // #171717 (gray-850)
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ export const defaultTheme: IThemeRGB = {
|
|||
'rgb-surface-destructive-hover': '153 27 27', // #991b1b (red-800)
|
||||
'rgb-surface-chat': '255 255 255', // #fff (white)
|
||||
'rgb-surface-code': '247 247 248', // #f7f7f8 (gray-50)
|
||||
'rgb-surface-code-body': '255 255 255', // #fff (white)
|
||||
'rgb-surface-inverted': '23 23 23', // #171717 (gray-850)
|
||||
'rgb-surface-inverted-hover': '47 47 47', // #2f2f2f (gray-700)
|
||||
'rgb-text-inverted': '255 255 255', // #fff (white)
|
||||
|
|
@ -98,7 +99,7 @@ export const defaultTheme: IThemeRGB = {
|
|||
// Brand colors
|
||||
'rgb-brand-purple': '126 34 206', // #7e22ce (purple-700)
|
||||
|
||||
/** Code syntax highlighting, measured against the `surface-code` fill. */
|
||||
/** Code syntax highlighting, measured against the `surface-code` and `surface-code-body` fills. */
|
||||
'rgb-syntax-text': '33 33 33', // #212121 (gray-800)
|
||||
'rgb-syntax-comment': '89 89 89', // #595959 (gray-500)
|
||||
'rgb-syntax-meta': '66 66 66', // #424242 (gray-600)
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ const textTokens: Array<keyof IThemeRGB> = [
|
|||
|
||||
/** Code blocks share the mode's own high-contrast canvas rather than a bundled
|
||||
* fallback that would reintroduce a grey surface. */
|
||||
const codeSurfaces: Array<keyof IThemeRGB> = ['rgb-surface-code'];
|
||||
const codeSurfaces: Array<keyof IThemeRGB> = ['rgb-surface-code', 'rgb-surface-code-body'];
|
||||
|
||||
const syntaxTokens: Array<keyof IThemeRGB> = [
|
||||
'rgb-syntax-text',
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@ export const highContrastLightTheme: IThemeRGB = {
|
|||
'rgb-surface-destructive-hover': '122 0 0', // #7a0000
|
||||
'rgb-surface-chat': '255 255 255', // #ffffff
|
||||
'rgb-surface-code': '255 255 255', // #ffffff, matching surface-primary-alt
|
||||
'rgb-surface-code-body': '255 255 255', // #ffffff, matching surface-chat
|
||||
'rgb-surface-inverted': '0 0 0', // #000000
|
||||
'rgb-surface-inverted-hover': '51 51 51', // #333333
|
||||
'rgb-text-inverted': '255 255 255', // #ffffff
|
||||
|
|
@ -230,6 +231,7 @@ export const highContrastDarkTheme: IThemeRGB = {
|
|||
'rgb-surface-destructive-hover': '255 179 179', // #ffb3b3
|
||||
'rgb-surface-chat': '0 0 0', // #000000
|
||||
'rgb-surface-code': '0 0 0', // #000000, matching presentation
|
||||
'rgb-surface-code-body': '0 0 0', // #000000, matching surface-primary-alt
|
||||
'rgb-surface-inverted': '255 255 255', // #ffffff
|
||||
'rgb-surface-inverted-hover': '212 212 212', // #d4d4d4
|
||||
'rgb-text-inverted': '0 0 0', // #000000
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
--color-surface-destructive-hover: rgb(var(--surface-destructive-hover));
|
||||
--color-surface-chat: rgb(var(--surface-chat));
|
||||
--color-surface-code: rgb(var(--surface-code));
|
||||
--color-surface-code-body: rgb(var(--surface-code-body));
|
||||
--color-surface-qr: rgb(var(--surface-qr));
|
||||
--color-surface-inverted: rgb(var(--surface-inverted));
|
||||
--color-surface-inverted-hover: rgb(var(--surface-inverted-hover));
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ export interface IThemeRGB {
|
|||
'rgb-surface-destructive-hover'?: string;
|
||||
'rgb-surface-chat'?: string;
|
||||
'rgb-surface-code'?: string;
|
||||
'rgb-surface-code-body'?: string;
|
||||
'rgb-surface-inverted'?: string;
|
||||
'rgb-surface-inverted-hover'?: string;
|
||||
'rgb-text-inverted'?: string;
|
||||
|
|
@ -192,6 +193,7 @@ export interface IThemeVariables {
|
|||
'--surface-destructive-hover': string;
|
||||
'--surface-chat': string;
|
||||
'--surface-code': string;
|
||||
'--surface-code-body': string;
|
||||
'--surface-inverted': string;
|
||||
'--surface-inverted-hover': string;
|
||||
'--text-inverted': string;
|
||||
|
|
@ -296,6 +298,7 @@ export interface IThemeColors {
|
|||
'surface-destructive-hover'?: string;
|
||||
'surface-chat'?: string;
|
||||
'surface-code'?: string;
|
||||
'surface-code-body'?: string;
|
||||
'surface-inverted'?: string;
|
||||
'surface-inverted-hover'?: string;
|
||||
'text-inverted'?: string;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue