diff --git a/src/features/settings/pages/editor/ColorSchemeBody.tsx b/src/features/settings/pages/editor/ColorSchemeBody.tsx index 6f8c368a0a..a7b1b31bfb 100644 --- a/src/features/settings/pages/editor/ColorSchemeBody.tsx +++ b/src/features/settings/pages/editor/ColorSchemeBody.tsx @@ -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], diff --git a/src/features/vcs/DiffEditor.module.css b/src/features/vcs/DiffEditor.module.css index 02fe16656c..be2445eb7b 100644 --- a/src/features/vcs/DiffEditor.module.css +++ b/src/features/vcs/DiffEditor.module.css @@ -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; diff --git a/src/features/vcs/cm.ts b/src/features/vcs/cm.ts index 5b8deb5ffb..92fe3ad485 100644 --- a/src/features/vcs/cm.ts +++ b/src/features/vcs/cm.ts @@ -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)))`, }, }, ]),