mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-24 08:03:19 +00:00
fix(color-scheme): an unticked Foreground keeps the text visible (#4065)
Unticking Foreground wrote the cleared colour, transparent, into the attribute's colour variable, so its tokens became invisible. A cleared foreground now falls back to the default text colour; cleared backgrounds and effects stay transparent. Refs #4059
This commit is contained in:
@@ -169,6 +169,9 @@ describe("color schemes", () => {
|
||||
expect(regular).toContain("--syn-keyword-bold: var(--fw-code, 400) !important");
|
||||
const cleared = schemeCss("theme-default", { light: { keyword: { background: CLEAR_COLOR } } }, root);
|
||||
expect(cleared).toContain("--syn-keyword-bg: transparent !important");
|
||||
// An unticked Foreground falls back to the default text colour instead of hiding the text.
|
||||
const noForeground = schemeCss("theme-default", { light: { predefined: { foreground: CLEAR_COLOR } } }, root);
|
||||
expect(noForeground).toContain("--syn-builtin: var(--fg-editor) !important");
|
||||
const upright = schemeCss("theme-default", { light: { staticSymbol: { italic: false } } }, root);
|
||||
expect(upright).toContain("--syn-static-italic: normal !important");
|
||||
const pythonItalic = schemeCss("theme-default", { light: { pyStaticSymbol: { italic: true } } }, root);
|
||||
|
||||
@@ -605,9 +605,11 @@ export function overrideDeclarations(
|
||||
const o = overrides[attr.id];
|
||||
if (!o) continue;
|
||||
if (setOrCleared(o.foreground) && attr.fg) {
|
||||
out.push([attr.fg, o.foreground]);
|
||||
// No foreground means the default text colour, not invisible text.
|
||||
const fg = o.foreground === CLEAR_COLOR && attr.id !== "text" ? "var(--fg-editor)" : o.foreground!;
|
||||
out.push([attr.fg, fg]);
|
||||
// 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 (attr.fg.startsWith("--ansi-")) out.push([`--terminal-ansi-${attr.fg.slice("--ansi-".length)}`, fg]);
|
||||
}
|
||||
if (setOrCleared(o.background) && attr.bg) out.push([attr.bg, o.background]);
|
||||
if (setOrCleared(o.effectColor) && attr.effect) out.push([attr.effect, o.effectColor]);
|
||||
|
||||
Reference in New Issue
Block a user