From dda79ca70ec157478460213b7c99de890ab00760 Mon Sep 17 00:00:00 2001 From: Dmitry Maluka Date: Tue, 14 Mar 2023 00:18:44 +0100 Subject: [PATCH] Add statusline.inactive and statusline.suggestions color groups (#1832) Add color groups for displaying statuslines of inactive split panes and the suggestions menu with colors different from the statusline of the active pane. --- internal/display/infowindow.go | 4 +++- internal/display/statusline.go | 16 +++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/internal/display/infowindow.go b/internal/display/infowindow.go index 3931067d..096c8d33 100644 --- a/internal/display/infowindow.go +++ b/internal/display/infowindow.go @@ -260,7 +260,9 @@ func (i *InfoWindow) Display() { done := false statusLineStyle := config.DefStyle.Reverse(true) - if style, ok := config.Colorscheme["statusline"]; ok { + if style, ok := config.Colorscheme["statusline.suggestions"]; ok { + statusLineStyle = style + } else if style, ok := config.Colorscheme["statusline"]; ok { statusLineStyle = style } keymenuOffset := 0 diff --git a/internal/display/statusline.go b/internal/display/statusline.go index be808eee..577c234d 100644 --- a/internal/display/statusline.go +++ b/internal/display/statusline.go @@ -110,7 +110,9 @@ func (s *StatusLine) Display() { // autocomplete suggestions (for the buffer, not for the infowindow) if b.HasSuggestions && len(b.Suggestions) > 1 { statusLineStyle := config.DefStyle.Reverse(true) - if style, ok := config.Colorscheme["statusline"]; ok { + if style, ok := config.Colorscheme["statusline.suggestions"]; ok { + statusLineStyle = style + } else if style, ok := config.Colorscheme["statusline"]; ok { statusLineStyle = style } x := 0 @@ -167,8 +169,16 @@ func (s *StatusLine) Display() { rightText = formatParser.ReplaceAllFunc(rightText, formatter) statusLineStyle := config.DefStyle.Reverse(true) - if style, ok := config.Colorscheme["statusline"]; ok { - statusLineStyle = style + if s.win.IsActive() { + if style, ok := config.Colorscheme["statusline"]; ok { + statusLineStyle = style + } + } else { + if style, ok := config.Colorscheme["statusline.inactive"]; ok { + statusLineStyle = style + } else if style, ok := config.Colorscheme["statusline"]; ok { + statusLineStyle = style + } } leftLen := util.StringWidth(leftText, util.CharacterCount(leftText), 1)