Skip to content

Commit ed25ed6

Browse files
committed
Fix selection color in codemirror editor
Related feedback: - uBlockOrigin/uBlock-issues#1963 (comment)
1 parent 3549043 commit ed25ed6

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

src/css/codemirror.css

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@
1515
.CodeMirror-cursor {
1616
border-color: var(--cm-cursor);
1717
}
18+
.CodeMirror-selected {
19+
background-color: var(--cm-selection-surface);
20+
}
1821
.CodeMirror-focused .CodeMirror-selected {
19-
background: var(--cm-selection-surface);
20-
color: var(--cm-selection-ink);
22+
background-color: var(--cm-selection-focused-surface);
2123
}
2224
.CodeMirror-foldmarker {
2325
color: var(--cm-foldmarker-ink);
@@ -31,8 +33,7 @@
3133
.CodeMirror-line::selection,
3234
.CodeMirror-line > span::selection,
3335
.CodeMirror-line > span > span::selection {
34-
background: var(--cm-selection-surface);
35-
color: var(--cm-selection-ink);
36+
background-color: var(--cm-selection-surface);
3637
}
3738
.CodeMirror-linenumber {
3839
color: var(--cm-gutter-ink);

src/css/themes/default.css

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@
242242
--cloud-used-surface: rgb(var(--violet-60));
243243

244244
/* codemirror */
245-
--cm-active-line: var(--surface-1);
245+
--cm-active-line: rgb(var(--gray-90));
246246
--cm-cursor: var(--ink-0);
247247
--cm-foldmarker-ink: rgb(var(--blue-40));
248248
--cm-gutter-border: var(--surface-1);
@@ -254,10 +254,10 @@
254254
--cm-merge-chunk-surface: rgb(var(--surface-0-rgb) / 40%);
255255
--cm-negative: #e32f00; /* h:15 S:100 Luv:50 */
256256
--cm-positive: #008a21; /* h:130 S:100 Luv:50 */
257-
--cm-selection-surface: rgb(var(--primary-70) / 50%);
258-
--cm-selection-ink: var(--ink-1);
259-
--cm-searching-ink: inherit;
260-
--cm-searching-surface: rgb(var(--yellow-20) / 80%);
257+
--cm-selection-surface: rgb(var(--gray-90));
258+
--cm-selection-focused-surface: rgb(var(--primary-90));
259+
--cm-searching-ink: black;
260+
--cm-searching-surface: #fee300cc /* h75 S:100 Luv:90 a:80% */;
261261
--cm-search-match-surface: rgb(var(--yellow-40) / 50%);
262262

263263
/* syntax highlight: static filtering */
@@ -322,14 +322,16 @@
322322
--cloud-used-surface: rgb(var(--violet-20));
323323

324324
/* codemirror */
325+
--cm-active-line: rgb(var(--gray-20));
325326
--cm-merge-copy-ink: rgb(var(--blue-30));
326327
--cm-foldmarker-ink: rgb(var(--blue-20));
327328
--cm-matchingbracket: rgb(var(--green-30) / 50%);
328329
--cm-negative: #ff8982; /* h:15 S:100 Luv:70 */
329330
--cm-positive: #00c634; /* h:130 S:100 Luv:70 */
330-
--cm-selection-surface: rgb(var(--primary-30) / 50%);
331-
--cm-searching-ink: var(--surface-0);
332-
--cm-searching-surface: rgb(var(--yellow-20));
331+
--cm-selection-surface: rgb(var(--gray-20));
332+
--cm-selection-focused-surface: rgb(var(--primary-20));
333+
--cm-searching-ink: black;
334+
--cm-searching-surface: #fee300cc /* h75 S:100 Luv:90 a:80% */;
333335

334336
/* syntax highlight: static filtering */
335337
--sf-comment-ink: var(--ink-3);

0 commit comments

Comments
 (0)