From b06f2e27ea07241dd12c0acecac8fcebb0491afc Mon Sep 17 00:00:00 2001 From: Gabriel Gondim <52431033+GGVidal@users.noreply.github.com> Date: Wed, 11 Nov 2026 12:40:04 -0300 Subject: [PATCH] =?UTF-8?q?feat(settings):=20Color=20Scheme=20=E2=80=BA=20?= =?UTF-8?q?Console=20Colors=20for=20the=20terminal's=20ANSI=20colors=20(#2?= =?UTF-8?q?751)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Settings › Editor › Color Scheme gets a Console Colors page, as in IntelliJ IDEA: the console background and the 16 ANSI colors, used by the terminal and consoles. A light IDE theme no longer forces a light terminal. IDEA's CONSOLE_* keys from .icls schemes and IntelliJ theme imports set the same colors. Closes #2698 Co-authored-by: GGVidal <52431033+GGVidal@users.noreply.github.com> --- src/features/plugins/intellijTheme.ts | 81 +++++++++++++++---- .../settings/__tests__/colorScheme.test.tsx | 15 +++- .../settings/pages/editor/colorScheme.tsx | 58 ++++++++++--- src/features/terminal/theme.ts | 4 +- src/platform/colorScheme.test.ts | 19 +++++ src/platform/colorScheme.ts | 33 +++++++- src/platform/icls.test.ts | 3 +- src/platform/icls.ts | 21 +++++ src/platform/locales/text/en.json | 14 ++++ src/platform/locales/text/zh.json | 14 ++++ src/styles/tokens.css | 3 + src/ui/ansi.module.css | 20 +---- 12 files changed, 238 insertions(+), 47 deletions(-) diff --git a/src/features/plugins/intellijTheme.ts b/src/features/plugins/intellijTheme.ts index 7a200f657..62a8e046c 100644 --- a/src/features/plugins/intellijTheme.ts +++ b/src/features/plugins/intellijTheme.ts @@ -108,6 +108,7 @@ export const ICLS_COLORS: Record = { MODIFIED_LINES_COLOR: ["--gutter-modified"], ADDED_LINES_COLOR: ["--gutter-added"], DELETED_LINES_COLOR: ["--gutter-deleted"], + CONSOLE_BACKGROUND_KEY: ["--bg-console"], }; type Part = "FOREGROUND" | "BACKGROUND" | "EFFECT_COLOR" | "ERROR_STRIPE_COLOR"; @@ -194,22 +195,70 @@ export const ICLS_ATTRIBUTES: Record> = { MARKDOWN_HEADER_LEVEL_1: [["FOREGROUND", "--syn-markup-heading"]], MARKDOWN_CODE_SPAN: [["FOREGROUND", "--syn-markup-code"]], MARKDOWN_LINK_TEXT: [["FOREGROUND", "--syn-link"]], - CONSOLE_BLACK_OUTPUT: [["FOREGROUND", "--ansi-black"]], - CONSOLE_RED_OUTPUT: [["FOREGROUND", "--ansi-red"]], - CONSOLE_GREEN_OUTPUT: [["FOREGROUND", "--ansi-green"]], - CONSOLE_YELLOW_OUTPUT: [["FOREGROUND", "--ansi-yellow"]], - CONSOLE_BLUE_OUTPUT: [["FOREGROUND", "--ansi-blue"]], - CONSOLE_MAGENTA_OUTPUT: [["FOREGROUND", "--ansi-magenta"]], - CONSOLE_CYAN_OUTPUT: [["FOREGROUND", "--ansi-cyan"]], - CONSOLE_GRAY_OUTPUT: [["FOREGROUND", "--ansi-white"]], - CONSOLE_DARKGRAY_OUTPUT: [["FOREGROUND", "--ansi-bright-black"]], - CONSOLE_RED_BRIGHT_OUTPUT: [["FOREGROUND", "--ansi-bright-red"]], - CONSOLE_GREEN_BRIGHT_OUTPUT: [["FOREGROUND", "--ansi-bright-green"]], - CONSOLE_YELLOW_BRIGHT_OUTPUT: [["FOREGROUND", "--ansi-bright-yellow"]], - CONSOLE_BLUE_BRIGHT_OUTPUT: [["FOREGROUND", "--ansi-bright-blue"]], - CONSOLE_MAGENTA_BRIGHT_OUTPUT: [["FOREGROUND", "--ansi-bright-magenta"]], - CONSOLE_CYAN_BRIGHT_OUTPUT: [["FOREGROUND", "--ansi-bright-cyan"]], - CONSOLE_WHITE_OUTPUT: [["FOREGROUND", "--ansi-bright-white"]], + CONSOLE_BLACK_OUTPUT: [ + ["FOREGROUND", "--ansi-black"], + ["FOREGROUND", "--terminal-ansi-black"], + ], + CONSOLE_RED_OUTPUT: [ + ["FOREGROUND", "--ansi-red"], + ["FOREGROUND", "--terminal-ansi-red"], + ], + CONSOLE_GREEN_OUTPUT: [ + ["FOREGROUND", "--ansi-green"], + ["FOREGROUND", "--terminal-ansi-green"], + ], + CONSOLE_YELLOW_OUTPUT: [ + ["FOREGROUND", "--ansi-yellow"], + ["FOREGROUND", "--terminal-ansi-yellow"], + ], + CONSOLE_BLUE_OUTPUT: [ + ["FOREGROUND", "--ansi-blue"], + ["FOREGROUND", "--terminal-ansi-blue"], + ], + CONSOLE_MAGENTA_OUTPUT: [ + ["FOREGROUND", "--ansi-magenta"], + ["FOREGROUND", "--terminal-ansi-magenta"], + ], + CONSOLE_CYAN_OUTPUT: [ + ["FOREGROUND", "--ansi-cyan"], + ["FOREGROUND", "--terminal-ansi-cyan"], + ], + CONSOLE_GRAY_OUTPUT: [ + ["FOREGROUND", "--ansi-white"], + ["FOREGROUND", "--terminal-ansi-white"], + ], + CONSOLE_DARKGRAY_OUTPUT: [ + ["FOREGROUND", "--ansi-bright-black"], + ["FOREGROUND", "--terminal-ansi-bright-black"], + ], + CONSOLE_RED_BRIGHT_OUTPUT: [ + ["FOREGROUND", "--ansi-bright-red"], + ["FOREGROUND", "--terminal-ansi-bright-red"], + ], + CONSOLE_GREEN_BRIGHT_OUTPUT: [ + ["FOREGROUND", "--ansi-bright-green"], + ["FOREGROUND", "--terminal-ansi-bright-green"], + ], + CONSOLE_YELLOW_BRIGHT_OUTPUT: [ + ["FOREGROUND", "--ansi-bright-yellow"], + ["FOREGROUND", "--terminal-ansi-bright-yellow"], + ], + CONSOLE_BLUE_BRIGHT_OUTPUT: [ + ["FOREGROUND", "--ansi-bright-blue"], + ["FOREGROUND", "--terminal-ansi-bright-blue"], + ], + CONSOLE_MAGENTA_BRIGHT_OUTPUT: [ + ["FOREGROUND", "--ansi-bright-magenta"], + ["FOREGROUND", "--terminal-ansi-bright-magenta"], + ], + CONSOLE_CYAN_BRIGHT_OUTPUT: [ + ["FOREGROUND", "--ansi-bright-cyan"], + ["FOREGROUND", "--terminal-ansi-bright-cyan"], + ], + CONSOLE_WHITE_OUTPUT: [ + ["FOREGROUND", "--ansi-bright-white"], + ["FOREGROUND", "--terminal-ansi-bright-white"], + ], }; export interface ConvertedTheme { diff --git a/src/features/settings/__tests__/colorScheme.test.tsx b/src/features/settings/__tests__/colorScheme.test.tsx index 0a2d23b67..8ecd9874b 100644 --- a/src/features/settings/__tests__/colorScheme.test.tsx +++ b/src/features/settings/__tests__/colorScheme.test.tsx @@ -134,7 +134,7 @@ describe("scheme actions", () => { filters: [{ name: "IntelliJ Color Scheme", extensions: ["icls", "xml"] }], }); expect(value("colorScheme")).toMatch(/^custom-/); - expect(screen.getByRole("status")).toHaveTextContent("Applied 12 values; skipped 3"); + expect(screen.getByRole("status")).toHaveTextContent("Applied 13 values; skipped 2"); const schemes = value("customSchemes") as Record; expect(Object.values(schemes).some((s) => s.name === "Material Darker")).toBe(true); }); @@ -369,3 +369,16 @@ describe("scheme attribute state", () => { expect(useSettingsDialog.getState().staged["global|editor.colorOverrides"]).toBeUndefined(); }); }); + +describe("Console Colors (#2698)", () => { + it("lists ANSI colours and selects Red from the preview", () => { + act(() => stage("editor.colorScheme", "global", "editor.colorScheme", "dark")); + schemePage("editor.colorScheme.console-colors"); + const tree = screen.getByRole("tree", { name: "Color scheme attributes" }); + expect(within(tree).getByRole("treeitem", { name: "Console background" })).toBeInTheDocument(); + expect(within(tree).getByRole("treeitem", { name: "Red" })).toBeInTheDocument(); + const preview = screen.getByLabelText("Color scheme preview"); + act(() => fireEvent.click(within(preview).getByText(/^red\s*$/))); + expect(screen.getByRole("treeitem", { name: "Red", selected: true })).toBeInTheDocument(); + }); +}); diff --git a/src/features/settings/pages/editor/colorScheme.tsx b/src/features/settings/pages/editor/colorScheme.tsx index d3b79033d..dfdf49c1d 100644 --- a/src/features/settings/pages/editor/colorScheme.tsx +++ b/src/features/settings/pages/editor/colorScheme.tsx @@ -97,7 +97,7 @@ function treeIds(nodes: readonly Node[], out = new Set()): Set { /** Settings sub-page that owns an attribute, for preview clicks that cross pages. */ function attrPageId(attr: AttributeDef): string { - return attr.path[0] === "Language Defaults" ? "editor.colorScheme.language-defaults" : languagePageId(attr.path[0]!); + return languagePageId(attr.path[0]!); } /** Preview click on another sub-page: the target page selects and reveals the attribute. */ @@ -121,6 +121,7 @@ function previewVars( k.startsWith("--fg-") || k.startsWith("--bg-") || k.startsWith("--border-") || + k.startsWith("--ansi-") || k === "--caret" ) vars[k] = v; @@ -234,6 +235,30 @@ const SAMPLES: Record = { ], caret: 2, }, + "Console Colors": { + code: [ + [ + ["black ", "ansiBlack"], + ["red ", "ansiRed"], + ["green ", "ansiGreen"], + ["yellow ", "ansiYellow"], + ["blue ", "ansiBlue"], + ["magenta ", "ansiMagenta"], + ["cyan ", "ansiCyan"], + ["white", "ansiWhite"], + ], + [ + ["dark ", "ansiBrightBlack"], + ["bright-red ", "ansiBrightRed"], + ["bright-green ", "ansiBrightGreen"], + ["bright-yellow ", "ansiBrightYellow"], + ["bright-blue ", "ansiBrightBlue"], + ["bright-magenta ", "ansiBrightMagenta"], + ["bright-cyan ", "ansiBrightCyan"], + ["bright-white", "ansiBrightWhite"], + ], + ], + }, "Language Defaults": { code: [ [["# Language Defaults", "lineComment"]], @@ -1189,10 +1214,15 @@ function ColorSchemePage({ scopes, landing }: { scopes: readonly string[]; landi const attr = ATTRIBUTES.find((a) => a.id === selected); const language = attr?.language; const inherited = useMemo(() => (attr ? resolvedAttribute(id, attr.id, customs) : {}), [id, attr, customs]); - const vars = useMemo( - () => ({ ...previewVars(id, mine, customs, language), ...fontWeightVars(weight, boldFontWeight) }) as CSSProperties, - [id, mine, customs, language, weight, boldFontWeight], - ); + const vars = useMemo(() => { + const next = { + ...previewVars(id, mine, customs, language), + ...fontWeightVars(weight, boldFontWeight), + } as CSSProperties & Record; + // Console preview sits on the console background, not the editor surface. + if (scopes[0] === "Console Colors" && next["--bg-console"]) next["--bg-editor"] = next["--bg-console"]; + return next; + }, [id, mine, customs, language, weight, boldFontWeight, scopes]); const baseVars = useMemo( () => ({ ...previewVars(id, mine, customs), ...fontWeightVars(weight, boldFontWeight) }) as CSSProperties, [id, mine, customs, weight, boldFontWeight], @@ -1441,16 +1471,18 @@ function ColorSchemePage({ scopes, landing }: { scopes: readonly string[]; landi } const LANGUAGES = [...new Set(ATTRIBUTES.map((a) => a.path[0]!))].filter( - (s) => !["General", "Debugger", "Language Defaults"].includes(s), + (s) => !["General", "Debugger", "Language Defaults", "Console Colors"].includes(s), ); -/** A language's sub-page id; `#` would end a settings link (`C#` → `csharp`). */ -const languagePageId = (language: string) => `editor.colorScheme.${language.toLowerCase().replace(/#/g, "sharp")}`; +/** A sub-page id: `C#` → `csharp`, `Console Colors` → `console-colors` (`#` would end a settings link). */ +const languagePageId = (language: string) => + `editor.colorScheme.${language.toLowerCase().replace(/#/g, "sharp").replace(/\s+/g, "-")}`; /** Sub-pages linked from the Color Scheme landing page, in sidebar order. */ const SCHEME_SUBPAGES = [ { id: "editor.colorScheme.general", title: "General" }, { id: "editor.colorScheme.language-defaults", title: "Language Defaults" }, { id: "editor.colorScheme.debugger", title: "Debugger" }, + { id: "editor.colorScheme.console-colors", title: "Console Colors" }, ...LANGUAGES.map((l) => ({ id: languagePageId(l), title: l })), ]; @@ -1543,11 +1575,19 @@ export const COLOR_SCHEME_PAGES: PageSpec[] = [ keywords: ["breakpoint", "inline values"], sections: [colorSchemeSection(["Debugger"])], }), + editorPage({ + id: "editor.colorScheme.console-colors", + title: "Console Colors", + order: 4, + projectScope: false, + keywords: ["terminal", "ansi", "console", "background"], + sections: [colorSchemeSection(["Console Colors"])], + }), ...LANGUAGES.map((language, i) => editorPage({ id: languagePageId(language), title: language, - order: 4 + i, + order: 5 + i, projectScope: false, keywords: ATTRIBUTES.filter((a) => a.path[0] === language).map((a) => a.name), sections: [colorSchemeSection([language])], diff --git a/src/features/terminal/theme.ts b/src/features/terminal/theme.ts index b61516100..5a3959011 100644 --- a/src/features/terminal/theme.ts +++ b/src/features/terminal/theme.ts @@ -43,12 +43,14 @@ export function buildTheme(read: TokenReader): ITheme { const color = (name: string, fallback = FALLBACK[name] ?? "#808080"): Rgba => parseColor(read(name)) ?? parseColor(fallback)!; - const bg = color("--bg-island", read("--bg-app") || FALLBACK["--bg-app"]); + // Console Colors edits `--bg-console`; fall back to the island / app surface. + const bg = color("--bg-console", read("--bg-island") || read("--bg-app") || FALLBACK["--bg-app"]); const fg = color("--fg-editor", read("--fg") || FALLBACK["--fg"]); const strong = color("--fg-strong"); const accent = color("--accent"); const caret = color("--caret", toHex(accent)); const selection = parseColor(read("--bg-editor-selection")); + // Theme `--terminal-ansi-*` first; Settings/import mirror `--ansi-*` into those names. const ansi = (name: string, derived: () => Rgba): Rgba => parseColor(read(`--terminal-ansi-${name}`)) ?? parseColor(read(`--ansi-${name}`)) ?? derived(); diff --git a/src/platform/colorScheme.test.ts b/src/platform/colorScheme.test.ts index 3ad8cb84e..90e8502fe 100644 --- a/src/platform/colorScheme.test.ts +++ b/src/platform/colorScheme.test.ts @@ -168,6 +168,25 @@ describe("color schemes", () => { expect(pythonItalic).toContain("--syn-python-static-italic: italic !important"); }); + it("mirrors Console Colors ANSI overrides to the terminal palette (#2698)", () => { + expect(ATTRIBUTES.filter((a) => a.path[0] === "Console Colors")).toHaveLength(17); + const root = document.documentElement; + root.dataset.theme = "light"; + const css = schemeCss( + "theme-default", + { + light: { + ansiRed: { foreground: "#aa0000" }, + consoleBackground: { background: "#101010" }, + }, + }, + root, + ); + expect(css).toContain("--ansi-red: #aa0000 !important"); + expect(css).toContain("--terminal-ansi-red: #aa0000 !important"); + expect(css).toContain("--bg-console: #101010 !important"); + }); + it("leaves selected text in syntax colours until a selection foreground is set (#2446)", () => { expect(ATTRIBUTES.find((a) => a.id === "selectionForeground")).toMatchObject({ name: "Selection foreground", diff --git a/src/platform/colorScheme.ts b/src/platform/colorScheme.ts index 195c1cba1..86a9dd1d2 100644 --- a/src/platform/colorScheme.ts +++ b/src/platform/colorScheme.ts @@ -135,6 +135,26 @@ const BASE_ATTRIBUTES: readonly AttributeDef[] = [ { id: "inlineValue", name: "Inline debugger values", path: ["Debugger"], fg: "--syn-inline-value" }, { id: "breakpointLine", name: "Breakpoint line", path: ["Debugger"], bg: "--bg-breakpoint-line" }, + // Console / terminal: IDEA's Console Colors (background + 16 ANSI). `--ansi-*` is mirrored + // to `--terminal-ansi-*` in overrideDeclarations so the terminal picks up edits. + { id: "consoleBackground", name: "Console background", path: ["Console Colors"], bg: "--bg-console" }, + { id: "ansiBlack", name: "Black", path: ["Console Colors"], fg: "--ansi-black" }, + { id: "ansiRed", name: "Red", path: ["Console Colors"], fg: "--ansi-red" }, + { id: "ansiGreen", name: "Green", path: ["Console Colors"], fg: "--ansi-green" }, + { id: "ansiYellow", name: "Yellow", path: ["Console Colors"], fg: "--ansi-yellow" }, + { id: "ansiBlue", name: "Blue", path: ["Console Colors"], fg: "--ansi-blue" }, + { id: "ansiMagenta", name: "Magenta", path: ["Console Colors"], fg: "--ansi-magenta" }, + { id: "ansiCyan", name: "Cyan", path: ["Console Colors"], fg: "--ansi-cyan" }, + { id: "ansiWhite", name: "White", path: ["Console Colors"], fg: "--ansi-white" }, + { id: "ansiBrightBlack", name: "Dark gray", path: ["Console Colors"], fg: "--ansi-bright-black" }, + { id: "ansiBrightRed", name: "Bright red", path: ["Console Colors"], fg: "--ansi-bright-red" }, + { id: "ansiBrightGreen", name: "Bright green", path: ["Console Colors"], fg: "--ansi-bright-green" }, + { id: "ansiBrightYellow", name: "Bright yellow", path: ["Console Colors"], fg: "--ansi-bright-yellow" }, + { id: "ansiBrightBlue", name: "Bright blue", path: ["Console Colors"], fg: "--ansi-bright-blue" }, + { id: "ansiBrightMagenta", name: "Bright magenta", path: ["Console Colors"], fg: "--ansi-bright-magenta" }, + { id: "ansiBrightCyan", name: "Bright cyan", path: ["Console Colors"], fg: "--ansi-bright-cyan" }, + { id: "ansiBrightWhite", name: "Bright white", path: ["Console Colors"], fg: "--ansi-bright-white" }, + syn("keyword", "Keyword", [LD], "keyword"), syn("identifier", "Identifiers › Local variable", [LD], "variable"), syn("parameter", "Identifiers › Parameter", [LD], "param"), @@ -405,7 +425,11 @@ export function overrideDeclarations( if (attr.language !== language) continue; const o = overrides[attr.id]; if (!o) continue; - if (setOrCleared(o.foreground) && attr.fg) out.push([attr.fg, o.foreground]); + if (setOrCleared(o.foreground) && attr.fg) { + out.push([attr.fg, o.foreground]); + // Terminal prefers `--terminal-ansi-*`; keep it in sync with console `--ansi-*`. + if (attr.fg.startsWith("--ansi-")) out.push([`--terminal-ansi-${attr.fg.slice("--ansi-".length)}`, o.foreground]); + } if (setOrCleared(o.background) && attr.bg) out.push([attr.bg, o.background]); if (setOrCleared(o.effectColor) && attr.effect) out.push([attr.effect, o.effectColor]); if (attr.effect && setOrCleared(o.effectColor)) { @@ -556,7 +580,12 @@ export function schemeCss( const pluginTheme = !!el?.dataset.pluginTheme && id === setting; if (id !== themeScheme(root) || pluginTheme) { const tokens = resolvedSchemeTokens(id, valid); - for (const [k, v] of tokens) if (SCHEME_VARS.has(k) || k.startsWith("--syn-")) decls.push([k, v]); + for (const [k, v] of tokens) + if (SCHEME_VARS.has(k) || k.startsWith("--syn-")) { + decls.push([k, v]); + // Terminal reads `--terminal-ansi-*`; keep it aligned with console `--ansi-*`. + if (k.startsWith("--ansi-")) decls.push([`--terminal-ansi-${k.slice("--ansi-".length)}`, v]); + } // The editor surface follows the scheme, not the island colour of the UI theme. const bg = tokens.get("--bg-editor") ?? tokens.get("--bg-island"); if (bg) decls.push(["--bg-editor", bg], ["--bg-editor-gutter", tokens.get("--bg-editor-gutter") ?? bg]); diff --git a/src/platform/icls.test.ts b/src/platform/icls.test.ts index a14003e28..ad17409c5 100644 --- a/src/platform/icls.test.ts +++ b/src/platform/icls.test.ts @@ -211,7 +211,8 @@ describe(".icls schemes", () => { expect(scheme.attributes.gutter?.background).toBe("#212121"); expect(scheme.attributes.lineNumber?.foreground).toBe("#424242"); expect(scheme.attributes.selection?.background).toBe("#353535"); - expect([applied, skipped]).toEqual([12, 3]); + expect(scheme.attributes.consoleBackground?.background).toBe("#212121"); + expect([applied, skipped]).toEqual([13, 2]); }); it.each([ diff --git a/src/platform/icls.ts b/src/platform/icls.ts index 7ae2a20f1..8dfa222f3 100644 --- a/src/platform/icls.ts +++ b/src/platform/icls.ts @@ -233,7 +233,28 @@ const COLOR_NAMES: Record = { INDENT_GUIDE: ["indentGuide", "foreground"], RIGHT_MARGIN_COLOR: ["rightMargin", "foreground"], METHOD_SEPARATORS_COLOR: ["methodSeparator", "foreground"], + CONSOLE_BACKGROUND_KEY: ["consoleBackground", "background"], }; + +Object.assign(ATTRIBUTE_NAMES, { + CONSOLE_BLACK_OUTPUT: "ansiBlack", + CONSOLE_RED_OUTPUT: "ansiRed", + CONSOLE_GREEN_OUTPUT: "ansiGreen", + CONSOLE_YELLOW_OUTPUT: "ansiYellow", + CONSOLE_BLUE_OUTPUT: "ansiBlue", + CONSOLE_MAGENTA_OUTPUT: "ansiMagenta", + CONSOLE_CYAN_OUTPUT: "ansiCyan", + CONSOLE_GRAY_OUTPUT: "ansiWhite", + CONSOLE_DARKGRAY_OUTPUT: "ansiBrightBlack", + CONSOLE_RED_BRIGHT_OUTPUT: "ansiBrightRed", + CONSOLE_GREEN_BRIGHT_OUTPUT: "ansiBrightGreen", + CONSOLE_YELLOW_BRIGHT_OUTPUT: "ansiBrightYellow", + CONSOLE_BLUE_BRIGHT_OUTPUT: "ansiBrightBlue", + CONSOLE_MAGENTA_BRIGHT_OUTPUT: "ansiBrightMagenta", + CONSOLE_CYAN_BRIGHT_OUTPUT: "ansiBrightCyan", + CONSOLE_WHITE_OUTPUT: "ansiBrightWhite", +}); + // Preserve editor attributes without a standard exchange name on our own round trip. for (const attr of ATTRIBUTES) if (!Object.values(ATTRIBUTE_NAMES).includes(attr.id)) ATTRIBUTE_NAMES[`OPENIDEA_${attr.id}`] = attr.id; diff --git a/src/platform/locales/text/en.json b/src/platform/locales/text/en.json index aff1b0526..d843305a9 100644 --- a/src/platform/locales/text/en.json +++ b/src/platform/locales/text/en.json @@ -1,10 +1,24 @@ { + "Black": "Black", + "Bright blue": "Bright blue", + "Bright cyan": "Bright cyan", + "Bright green": "Bright green", + "Bright magenta": "Bright magenta", + "Bright red": "Bright red", + "Bright white": "Bright white", + "Bright yellow": "Bright yellow", + "Console Colors": "Console Colors", + "Console background": "Console background", + "Cyan": "Cyan", + "Dark gray": "Dark gray", + "Magenta": "Magenta", "The program ended by itself, so no garbage collection ran before the profile was written: objects that were already unreachable may show as live.": "The program ended by itself, so no garbage collection ran before the profile was written: objects that were already unreachable may show as live.", "No garbage collection finished before the program stopped (the JVM's attach listener did not answer in time or was not reachable): objects that were already unreachable may show as live.": "No garbage collection finished before the program stopped (the JVM's attach listener did not answer in time or was not reachable): objects that were already unreachable may show as live.", "Profile Allocations": "Profile Allocations", "Profile Live Objects": "Profile Live Objects", "Allocations": "Allocations", "Live Objects": "Live Objects", + "White": "White", "allocated": "allocated", "{size} allocated": "{size} allocated", "1 live sample (≈ 512 KB)": "1 live sample (≈ 512 KB)", diff --git a/src/platform/locales/text/zh.json b/src/platform/locales/text/zh.json index 0e2f0c01b..8347790a4 100644 --- a/src/platform/locales/text/zh.json +++ b/src/platform/locales/text/zh.json @@ -1,10 +1,24 @@ { + "Black": "黑色", + "Bright blue": "亮蓝色", + "Bright cyan": "亮青色", + "Bright green": "亮绿色", + "Bright magenta": "亮品红色", + "Bright red": "亮红色", + "Bright white": "亮白色", + "Bright yellow": "亮黄色", + "Console Colors": "控制台颜色", + "Console background": "控制台背景", + "Cyan": "青色", + "Dark gray": "深灰色", + "Magenta": "品红色", "The program ended by itself, so no garbage collection ran before the profile was written: objects that were already unreachable may show as live.": "程序自行结束,因此在写入分析结果前没有执行垃圾回收:本已不可达的对象可能显示为存活。", "No garbage collection finished before the program stopped (the JVM's attach listener did not answer in time or was not reachable): objects that were already unreachable may show as live.": "程序停止前没有完成垃圾回收(JVM 的 attach 监听器未及时响应或无法访问):本已不可达的对象可能显示为存活。", "Profile Allocations": "分析内存分配", "Profile Live Objects": "分析存活对象", "Allocations": "内存分配", "Live Objects": "存活对象", + "White": "白色", "allocated": "已分配", "{size} allocated": "已分配 {size}", "1 live sample (≈ 512 KB)": "1 个存活样本(≈ 512 KB)", diff --git a/src/styles/tokens.css b/src/styles/tokens.css index ef85e4b91..1892d6f6f 100644 --- a/src/styles/tokens.css +++ b/src/styles/tokens.css @@ -219,6 +219,9 @@ html { --fg-weak-warning: #6f737a; --fg-bulb: #f2c55c; + /* console / terminal surfaces (Color Scheme › Console Colors) */ + --bg-console: var(--bg-island); + /* terminal / console ANSI palette */ --ansi-black: #000000; --ansi-red: #f0524f; diff --git a/src/ui/ansi.module.css b/src/ui/ansi.module.css index b9ec6c2c8..47d37816d 100644 --- a/src/ui/ansi.module.css +++ b/src/ui/ansi.module.css @@ -1,19 +1,5 @@ -/* ANSI palette of the Run and Debug consoles, derived from tokens (spans reference these). */ +/* ANSI palette for Run and Debug consoles: inherit `--ansi-*` from the scheme + * (Color Scheme › Console Colors / imported CONSOLE_*). Marker class only. */ .palette { - --ansi-black: var(--control-off); - --ansi-red: var(--danger); - --ansi-green: var(--success); - --ansi-yellow: var(--warning); - --ansi-blue: var(--syn-keyword); - --ansi-magenta: var(--syn-annotation); - --ansi-cyan: color-mix(in srgb, var(--syn-keyword) 50%, var(--syn-string)); - --ansi-white: var(--fg); - --ansi-bright-black: var(--fg-subtle); - --ansi-bright-red: color-mix(in srgb, var(--danger) 72%, var(--fg-strong)); - --ansi-bright-green: color-mix(in srgb, var(--success) 72%, var(--fg-strong)); - --ansi-bright-yellow: color-mix(in srgb, var(--warning) 72%, var(--fg-strong)); - --ansi-bright-blue: color-mix(in srgb, var(--syn-keyword) 72%, var(--fg-strong)); - --ansi-bright-magenta: color-mix(in srgb, var(--syn-annotation) 72%, var(--fg-strong)); - --ansi-bright-cyan: color-mix(in srgb, var(--ansi-cyan) 72%, var(--fg-strong)); - --ansi-bright-white: var(--fg-strong); + display: contents; }