From 31da0d8678f1eebe3d478c4e6c5d677fd0972c22 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Thu, 4 May 2023 15:13:32 +0200 Subject: [PATCH] Fix codemirror selection color (#16409) --- src/resources/codemirror.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/resources/codemirror.ts b/src/resources/codemirror.ts index f16e1f61f0..c419dd4a0c 100644 --- a/src/resources/codemirror.ts +++ b/src/resources/codemirror.ts @@ -46,7 +46,6 @@ export const haTheme = EditorView.theme({ color: "var(--primary-text-color)", backgroundColor: "var(--code-editor-background-color, var(--mdc-text-field-fill-color, whitesmoke))", - "& ::selection": { backgroundColor: "rgba(var(--rgb-primary-color), 0.3)" }, borderRadius: "var(--mdc-shape-small, 4px) var(--mdc-shape-small, 4px) 0px 0px", caretColor: "var(--secondary-text-color)", @@ -54,14 +53,20 @@ export const haTheme = EditorView.theme({ maxHeight: "var(--code-mirror-max-height, unset)", }, - "&.cm-editor.cm-focused": { outline: "none" }, + "&.cm-editor.cm-focused": { + outline: "none", + }, "&.cm-focused .cm-cursor": { borderLeftColor: "var(--secondary-text-color)", }, - "&.cm-focused .cm-selectionBackground, .cm-selectionBackground": { - backgroundColor: "rgba(var(--rgb-primary-color), 0.3)", + ".cm-selectionBackground, ::selection": { + backgroundColor: "rgba(var(--rgb-primary-color), 0.1)", + }, + + "&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground": { + backgroundColor: "rgba(var(--rgb-primary-color), 0.2)", }, ".cm-activeLine": {