Skip to content

Commit e0d2752

Browse files
committed
fix(yasgui): keep the editor selection visible in the light theme
The redesigned active line used an opaque fill, which covered CodeMirror's selection layer (drawn behind the text lines), and CodeMirror's own light selection grey barely showed. The active line is now translucent and the default light theme uses a blue selection colour.
1 parent d43122d commit e0d2752

3 files changed

Lines changed: 23 additions & 1 deletion

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@matdata/yasgui": patch
3+
---
4+
5+
Text selected in the query editor is clearly visible again in the light theme, including on the line with the cursor.

‎packages/yasgui/src/tab.scss‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,16 @@
917917
}
918918

919919
.cm-activeLine {
920-
background: var(--yasgui-surface-sunken, #edf1f6);
920+
background: var(--yasgui-editor-active-line, rgba(28, 38, 51, 0.05));
921+
}
922+
923+
// CodeMirror's own light selection (#d9d9d9 / #d7d4f0) barely shows on the
924+
// redesigned surfaces; the other themes set their own selection colour.
925+
.cm-s-default .cm-selectionBackground {
926+
background: var(--yasgui-editor-selection, rgba(5, 99, 187, 0.22));
927+
}
928+
.cm-s-default.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground {
929+
background: var(--yasgui-editor-selection-focused, rgba(5, 99, 187, 0.3));
921930
}
922931

923932
.cm-activeLineGutter {

‎packages/yasgui/src/themes.scss‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
--yasgui-surface-raised: #ffffff;
99
--yasgui-surface-sunken: #edf1f6;
1010
--yasgui-surface-selected: #e6ecf3;
11+
// Editor highlights. The active line is translucent because CodeMirror draws the
12+
// selection layer behind the text lines, so an opaque fill would hide the selection.
13+
--yasgui-editor-active-line: rgba(28, 38, 51, 0.05);
14+
--yasgui-editor-selection: rgba(5, 99, 187, 0.22);
15+
--yasgui-editor-selection-focused: rgba(5, 99, 187, 0.3);
1116
--yasgui-line: #dfe5ec;
1217
--yasgui-line-soft: #edf0f4;
1318
--yasgui-line-strong: #808893;
@@ -99,6 +104,9 @@
99104
--yasgui-surface-raised: #141920;
100105
--yasgui-surface-sunken: #1c222b;
101106
--yasgui-surface-selected: #232b36;
107+
--yasgui-editor-active-line: rgba(255, 255, 255, 0.04);
108+
--yasgui-editor-selection: rgba(90, 168, 242, 0.25);
109+
--yasgui-editor-selection-focused: rgba(90, 168, 242, 0.35);
102110
--yasgui-line: #252d38;
103111
--yasgui-line-soft: #1d242d;
104112
--yasgui-line-strong: #6f7e8c;

0 commit comments

Comments
 (0)