fix(editor): paint diff panes and the colour scheme list with the editor scheme's colours, not the UI theme's (#8227)

With an editor colour scheme of the other brightness than the UI theme, the diff panes kept the theme's --bg-app / --fg while their syntax colours came from the scheme, and the Color Scheme page applied every UI token of the scheme to its attribute list. The diff viewer now uses --bg-editor, --fg-editor and --bg-editor-gutter like the editor, the strip between panes follows the editor surface, and the scheme page gives its list only the scheme's editor tokens.

Closes #8160

Co-authored-by: coding46 <[email protected]>
Цей коміт міститься в:
G. Bodenschatzтаcoding46 authored and GitHub committed 2026-12-05 22:34:54 +08:00
1 джерело 3f74972f11
коміт 68ffce6340
3 files changed
+16 -6

No files matched your search

+8 -1
Переглянути файл
@@ -1852,10 +1852,17 @@ export function ColorSchemePage({
if (scopes[0] === "Console Colors" && next["--bg-console"]) next["--bg-editor"] = next["--bg-console"];
return next;
}, [id, mine, customs, language, weight, boldFontWeight, scopes, redGreen, themeTokens]);
// The attribute list and its controls sit on the UI's surface: they take the scheme's editor
// tokens, not its UI ones (`--fg-strong`, `--bg-app`, `--border-*`), which a scheme other than
// the theme's own would turn into unreadable text on the theme's background.
const baseVars = useMemo(
() =>
({
...previewVars(id, mine, customs, undefined, redGreen, themeTokens),
...Object.fromEntries(
Object.entries(previewVars(id, mine, customs, undefined, redGreen, themeTokens)).filter(
([key]) => !/^--(?:fg|bg|border)-(?!editor)/.test(key),
),
),
...fontWeightVars(weight, boldFontWeight),
}) as CSSProperties,
[id, mine, customs, weight, boldFontWeight, redGreen, themeTokens],
+2 -1
Переглянути файл
@@ -362,7 +362,8 @@
flex: none;
width: 30px;
overflow: hidden;
background: var(--bg-app);
/* Between the two panes: their surface, which a colour scheme changes. */
background: var(--bg-editor, var(--bg-app));
border-left: 1px solid var(--border);
border-right: 1px solid var(--border);
cursor: col-resize;
+6 -4
Переглянути файл
@@ -403,8 +403,10 @@ export const viewerTheme = EditorView.theme(
...overviewStyles,
"&.cm-editor": { height: "100%" },
"&": {
backgroundColor: "var(--bg-app)",
color: "var(--fg)",
// The editor colour scheme's surface and text, as the regular editor (a scheme other than
// the theme's own changes these, not the UI's `--bg-app` / `--fg`).
backgroundColor: "var(--bg-editor, var(--bg-island, var(--bg-app)))",
color: "var(--fg-editor, var(--fg))",
fontSize: "var(--openidea-editor-font-size, var(--fs-code))",
...findLocals,
},
@@ -436,7 +438,7 @@ export const viewerTheme = EditorView.theme(
},
".cm-activeLine": { backgroundColor: "var(--bg-current-line)" },
".cm-gutters": {
backgroundColor: "var(--bg-app)",
backgroundColor: "var(--bg-editor-gutter, var(--bg-editor, var(--bg-island, var(--bg-app))))",
color: "var(--fg-gutter)",
border: "none",
},
@@ -473,7 +475,7 @@ export const viewerTheme = EditorView.theme(
},
{
[`.cm-diffGutter-fine.cm-diffGutter-${k}`]: {
backgroundColor: `color-mix(in srgb, var(--diff-${k}) 40%, var(--bg-app))`,
backgroundColor: `color-mix(in srgb, var(--diff-${k}) 40%, var(--bg-editor, var(--bg-app)))`,
},
},
]),