diff options
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/config/user_config.go | 25 | ||||
-rw-r--r-- | pkg/gui/context.go | 4 | ||||
-rw-r--r-- | pkg/gui/context/view_trait.go | 1 | ||||
-rw-r--r-- | pkg/gui/views.go | 1 | ||||
-rw-r--r-- | pkg/theme/theme.go | 6 |
5 files changed, 26 insertions, 11 deletions
diff --git a/pkg/config/user_config.go b/pkg/config/user_config.go index 47fbe2eea..7ab567fbe 100644 --- a/pkg/config/user_config.go +++ b/pkg/config/user_config.go @@ -179,6 +179,8 @@ type ThemeConfig struct { // Background color of selected line. // See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#highlighting-the-selected-line SelectedLineBgColor []string `yaml:"selectedLineBgColor" jsonschema:"minItems=1,uniqueItems=true"` + // Background color of selected line when view doesn't have focus. + InactiveViewSelectedLineBgColor []string `yaml:"inactiveViewSelectedLineBgColor" jsonschema:"minItems=1,uniqueItems=true"` // Foreground color of copied commit CherryPickedCommitFgColor []string `yaml:"cherryPickedCommitFgColor" jsonschema:"minItems=1,uniqueItems=true"` // Background color of copied commit @@ -668,17 +670,18 @@ func GetDefaultConfig() *UserConfig { TimeFormat: "02 Jan 06", ShortTimeFormat: time.Kitchen, Theme: ThemeConfig{ - ActiveBorderColor: []string{"green", "bold"}, - SearchingActiveBorderColor: []string{"cyan", "bold"}, - InactiveBorderColor: []string{"default"}, - OptionsTextColor: []string{"blue"}, - SelectedLineBgColor: []string{"blue"}, - CherryPickedCommitBgColor: []string{"cyan"}, - CherryPickedCommitFgColor: []string{"blue"}, - MarkedBaseCommitBgColor: []string{"yellow"}, - MarkedBaseCommitFgColor: []string{"blue"}, - UnstagedChangesColor: []string{"red"}, - DefaultFgColor: []string{"default"}, + ActiveBorderColor: []string{"green", "bold"}, + SearchingActiveBorderColor: []string{"cyan", "bold"}, + InactiveBorderColor: []string{"default"}, + OptionsTextColor: []string{"blue"}, + SelectedLineBgColor: []string{"blue"}, + InactiveViewSelectedLineBgColor: []string{"bold"}, + CherryPickedCommitBgColor: []string{"cyan"}, + CherryPickedCommitFgColor: []string{"blue"}, + MarkedBaseCommitBgColor: []string{"yellow"}, + MarkedBaseCommitFgColor: []string{"blue"}, + UnstagedChangesColor: []string{"red"}, + DefaultFgColor: []string{"default"}, }, CommitAuthorFormat: "auto", CommitLength: CommitLengthConfig{Show: true}, diff --git a/pkg/gui/context.go b/pkg/gui/context.go index be5a720e3..28ecf2405 100644 --- a/pkg/gui/context.go +++ b/pkg/gui/context.go @@ -230,6 +230,10 @@ func (self *ContextMgr) ActivateContext(c types.Context, opts types.OnFocusOpts) self.gui.helpers.Window.SetWindowContext(c) self.gui.helpers.Window.MoveToTopOfWindow(c) + oldView := self.gui.c.GocuiGui().CurrentView() + if oldView != nil && oldView.Name() != viewName { + oldView.HighlightInactive = true + } if _, err := self.gui.c.GocuiGui().SetCurrentView(viewName); err != nil { return err } diff --git a/pkg/gui/context/view_trait.go b/pkg/gui/context/view_trait.go index 191419897..5342071ef 100644 --- a/pkg/gui/context/view_trait.go +++ b/pkg/gui/context/view_trait.go @@ -49,6 +49,7 @@ func (self *ViewTrait) SetContent(content string) { func (self *ViewTrait) SetHighlight(highlight bool) { self.view.Highlight = highlight + self.view.HighlightInactive = false } func (self *ViewTrait) SetFooter(value string) { diff --git a/pkg/gui/views.go b/pkg/gui/views.go index 9fd775764..9a4fa0a47 100644 --- a/pkg/gui/views.go +++ b/pkg/gui/views.go @@ -92,6 +92,7 @@ func (gui *Gui) createAllViews() error { (*mapping.viewPtr).FrameRunes = frameRunes (*mapping.viewPtr).FgColor = theme.GocuiDefaultTextColor (*mapping.viewPtr).SelBgColor = theme.GocuiSelectedLineBgColor + (*mapping.viewPtr).InactiveViewSelBgColor = theme.GocuiInactiveViewSelectedLineBgColor } gui.Views.Options.Frame = false diff --git a/pkg/theme/theme.go b/pkg/theme/theme.go index 78be46fb6..acd8ebf71 100644 --- a/pkg/theme/theme.go +++ b/pkg/theme/theme.go @@ -24,11 +24,15 @@ var ( // GocuiSelectedLineBgColor is the background color for the selected line in gocui GocuiSelectedLineBgColor gocui.Attribute + // GocuiInactiveViewSelectedLineBgColor is the background color for the selected line in gocui if the view doesn't have focus + GocuiInactiveViewSelectedLineBgColor gocui.Attribute OptionsColor gocui.Attribute // SelectedLineBgColor is the background color for the selected line SelectedLineBgColor = style.New() + // InactiveViewSelectedLineBgColor is the background color for the selected line if the view doesn't have the focus + InactiveViewSelectedLineBgColor = style.New() // CherryPickedCommitColor is the text style when cherry picking a commit CherryPickedCommitTextStyle = style.New() @@ -49,6 +53,7 @@ func UpdateTheme(themeConfig config.ThemeConfig) { InactiveBorderColor = GetGocuiStyle(themeConfig.InactiveBorderColor) SearchingActiveBorderColor = GetGocuiStyle(themeConfig.SearchingActiveBorderColor) SelectedLineBgColor = GetTextStyle(themeConfig.SelectedLineBgColor, true) + InactiveViewSelectedLineBgColor = GetTextStyle(themeConfig.InactiveViewSelectedLineBgColor, true) cherryPickedCommitBgTextStyle := GetTextStyle(themeConfig.CherryPickedCommitBgColor, true) cherryPickedCommitFgTextStyle := GetTextStyle(themeConfig.CherryPickedCommitFgColor, false) @@ -62,6 +67,7 @@ func UpdateTheme(themeConfig config.ThemeConfig) { UnstagedChangesColor = unstagedChangesTextStyle GocuiSelectedLineBgColor = GetGocuiStyle(themeConfig.SelectedLineBgColor) + GocuiInactiveViewSelectedLineBgColor = GetGocuiStyle(themeConfig.InactiveViewSelectedLineBgColor) OptionsColor = GetGocuiStyle(themeConfig.OptionsTextColor) OptionsFgColor = GetTextStyle(themeConfig.OptionsTextColor, false) |