@@ -81,6 +81,11 @@ type View struct {
81
81
// foreground colors of the selected line, when it is highlighted.
82
82
SelBgColor , SelFgColor Attribute
83
83
84
+ // InactiveViewSelBgColor is used to configure the background color of the
85
+ // selected line, when it is highlighted but the view doesn't have the
86
+ // focus.
87
+ InactiveViewSelBgColor Attribute
88
+
84
89
// If Editable is true, keystrokes will be added to the view's internal
85
90
// buffer at the cursor position.
86
91
Editable bool
@@ -96,6 +101,9 @@ type View struct {
96
101
// If Highlight is true, Sel{Bg,Fg}Colors will be used
97
102
// for the line under the cursor position.
98
103
Highlight bool
104
+ // If HighlightInactive is true, InavtiveViewSel{Bg,Fg}Colors will be used
105
+ // instead of Sel{Bg,Fg}Colors for highlighting selected lines.
106
+ HighlightInactive bool
99
107
100
108
// If Frame is true, a border will be drawn around the view.
101
109
Frame bool
@@ -404,6 +412,7 @@ func newView(name string, x0, y0, x1, y1 int, mode OutputMode) *View {
404
412
405
413
v .FgColor , v .BgColor = ColorDefault , ColorDefault
406
414
v .SelFgColor , v .SelBgColor = ColorDefault , ColorDefault
415
+ v .InactiveViewSelBgColor = ColorDefault
407
416
v .TitleColor , v .FrameColor = ColorDefault , ColorDefault
408
417
return v
409
418
}
@@ -506,7 +515,11 @@ func (v *View) setRune(x, y int, ch rune, fgColor, bgColor Attribute) error {
506
515
fgColor += 8
507
516
}
508
517
fgColor = fgColor | AttrBold
509
- bgColor = bgColor | v .SelBgColor
518
+ if v .HighlightInactive {
519
+ bgColor = bgColor | v .InactiveViewSelBgColor
520
+ } else {
521
+ bgColor = bgColor | v .SelBgColor
522
+ }
510
523
}
511
524
}
512
525
0 commit comments