Skip to content

Commit 114a8b7

Browse files
committed
fix: terminal search box can have low contrast in dark themes
1 parent 59cde62 commit 114a8b7

File tree

3 files changed

+54
-9
lines changed

3 files changed

+54
-9
lines changed

plugins/plugin-codeflare/src/components/Terminal.tsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -217,14 +217,6 @@ export default class XTerm extends React.PureComponent<Props, State> {
217217
xterm.setOption("theme", itheme)
218218
xterm.setOption("fontFamily", val("monospace", "font"))
219219

220-
// strange. these values don't seem to have any effect
221-
this.searchOptions.decorations = {
222-
activeMatchBackground: val("var(--color-base09)"),
223-
matchBackground: val("var(--color-base02)"),
224-
matchOverviewRuler: val("var(--color-base05)"),
225-
activeMatchColorOverviewRuler: val("var(--color-base05)"),
226-
}
227-
228220
try {
229221
const standIn = document.querySelector("body .repl .repl-input input")
230222
if (standIn) {
@@ -258,7 +250,11 @@ export default class XTerm extends React.PureComponent<Props, State> {
258250
private searchOptions: ISearchOptions = {
259251
regex: true,
260252
caseSensitive: true,
261-
decorations: { matchOverviewRuler: "orange", activeMatchColorOverviewRuler: "green" }, // placeholder; see injectTheme above
253+
decorations: { matchOverviewRuler: "orange", activeMatchColorOverviewRuler: "green" },
254+
// ^^ re: odd colors; these need to be something in order for the
255+
// our onSearch handler to be called... the actual values don't seem
256+
// to matter at the moment; let's make them obvious so we can spot
257+
// regressions in the future
262258
}
263259

264260
private readonly onSearch = (filter: string) => {

plugins/plugin-codeflare/web/scss/components/Terminal/_index.scss

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,31 @@
1919
@include CodeFlareToolbar {
2020
padding: 0;
2121
font-family: var(--font-sans-serif);
22+
background-color: var(--color-base00);
23+
min-height: 2em;
24+
25+
@include SearchBadge {
26+
color: var(--color-text-01);
27+
}
2228

2329
@include SearchIcon {
2430
z-index: 10;
31+
color: var(--color-text-02);
2532
}
33+
34+
@include SearchInputGroup {
35+
background-color: transparent;
36+
--pf-c-text-input-group__text--before--BorderColor: transparent;
37+
38+
input {
39+
background-color: transparent;
40+
color: var(--color-text-01);
41+
}
42+
}
43+
}
44+
45+
@include SearchResultActive {
46+
opacity: 0.2;
47+
background-color: var(--color-base0E);
48+
z-index: 10 !important;
2649
}

plugins/plugin-codeflare/web/scss/components/Terminal/_mixins.scss

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,34 @@
2020
}
2121
}
2222

23+
@mixin SearchInputGroup {
24+
.pf-c-text-input-group {
25+
@content;
26+
}
27+
}
28+
29+
@mixin SearchBadge {
30+
.pf-c-badge {
31+
@content;
32+
}
33+
}
34+
2335
@mixin SearchIcon {
2436
.pf-c-text-input-group__icon {
2537
@content;
2638
}
2739
}
40+
41+
@mixin SearchResult {
42+
.xterm-find-result-decoration {
43+
@content;
44+
}
45+
}
46+
47+
@mixin SearchResultActive {
48+
@include SearchResult {
49+
&.xterm-find-active-result-decoration {
50+
@content;
51+
}
52+
}
53+
}

0 commit comments

Comments
 (0)