diff options
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/config/user_config.go | 38 | ||||
-rw-r--r-- | pkg/gui/controllers/helpers/search_helper.go | 14 | ||||
-rw-r--r-- | pkg/gui/views.go | 11 | ||||
-rw-r--r-- | pkg/theme/theme.go | 4 |
4 files changed, 43 insertions, 24 deletions
diff --git a/pkg/config/user_config.go b/pkg/config/user_config.go index c3e4fc07f..8faff4326 100644 --- a/pkg/config/user_config.go +++ b/pkg/config/user_config.go @@ -60,15 +60,16 @@ type GuiConfig struct { } type ThemeConfig struct { - ActiveBorderColor []string `yaml:"activeBorderColor"` - InactiveBorderColor []string `yaml:"inactiveBorderColor"` - OptionsTextColor []string `yaml:"optionsTextColor"` - SelectedLineBgColor []string `yaml:"selectedLineBgColor"` - SelectedRangeBgColor []string `yaml:"selectedRangeBgColor"` - CherryPickedCommitBgColor []string `yaml:"cherryPickedCommitBgColor"` - CherryPickedCommitFgColor []string `yaml:"cherryPickedCommitFgColor"` - UnstagedChangesColor []string `yaml:"unstagedChangesColor"` - DefaultFgColor []string `yaml:"defaultFgColor"` + ActiveBorderColor []string `yaml:"activeBorderColor"` + InactiveBorderColor []string `yaml:"inactiveBorderColor"` + SearchingActiveBorderColor []string `yaml:"searchingActiveBorderColor"` + OptionsTextColor []string `yaml:"optionsTextColor"` + SelectedLineBgColor []string `yaml:"selectedLineBgColor"` + SelectedRangeBgColor []string `yaml:"selectedRangeBgColor"` + CherryPickedCommitBgColor []string `yaml:"cherryPickedCommitBgColor"` + CherryPickedCommitFgColor []string `yaml:"cherryPickedCommitFgColor"` + UnstagedChangesColor []string `yaml:"unstagedChangesColor"` + DefaultFgColor []string `yaml:"defaultFgColor"` } type CommitLengthConfig struct { @@ -409,15 +410,16 @@ func GetDefaultConfig() *UserConfig { TimeFormat: "02 Jan 06", ShortTimeFormat: time.Kitchen, Theme: ThemeConfig{ - ActiveBorderColor: []string{"green", "bold"}, - InactiveBorderColor: []string{"default"}, - OptionsTextColor: []string{"blue"}, - SelectedLineBgColor: []string{"blue"}, - SelectedRangeBgColor: []string{"blue"}, - CherryPickedCommitBgColor: []string{"cyan"}, - CherryPickedCommitFgColor: []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"}, + SelectedRangeBgColor: []string{"blue"}, + CherryPickedCommitBgColor: []string{"cyan"}, + CherryPickedCommitFgColor: []string{"blue"}, + UnstagedChangesColor: []string{"red"}, + DefaultFgColor: []string{"default"}, }, CommitLength: CommitLengthConfig{Show: true}, SkipNoStagedFilesWarning: false, diff --git a/pkg/gui/controllers/helpers/search_helper.go b/pkg/gui/controllers/helpers/search_helper.go index 7d552a373..9f0e51e88 100644 --- a/pkg/gui/controllers/helpers/search_helper.go +++ b/pkg/gui/controllers/helpers/search_helper.go @@ -201,11 +201,13 @@ func (self *SearchHelper) OnPromptContentChanged(searchString string) { func (self *SearchHelper) DisplaySearchStatusIfSearching(c types.Context) { if searchableContext, ok := c.(types.ISearchableContext); ok { if searchableContext.IsSearching() { + self.setSearchingFrameColor() self.DisplaySearchStatus(searchableContext) } } if filterableContext, ok := c.(types.IFilterableContext); ok { if filterableContext.IsFiltering() { + self.setSearchingFrameColor() self.DisplayFilterStatus(filterableContext) } } @@ -232,6 +234,18 @@ func (self *SearchHelper) CancelSearchIfSearching(c types.Context) { } func (self *SearchHelper) HidePrompt() { + self.setNonSearchingFrameColor() + state := self.searchState() state.Context = nil } + +func (self *SearchHelper) setSearchingFrameColor() { + self.c.GocuiGui().SelFgColor = theme.SearchingActiveBorderColor + self.c.GocuiGui().SelFrameColor = theme.SearchingActiveBorderColor +} + +func (self *SearchHelper) setNonSearchingFrameColor() { + self.c.GocuiGui().SelFgColor = theme.ActiveBorderColor + self.c.GocuiGui().SelFrameColor = theme.ActiveBorderColor +} diff --git a/pkg/gui/views.go b/pkg/gui/views.go index 043acdaed..15bd3c867 100644 --- a/pkg/gui/views.go +++ b/pkg/gui/views.go @@ -91,10 +91,14 @@ func (gui *Gui) createAllViews() error { gui.Views.Options.Frame = false gui.Views.SearchPrefix.BgColor = gocui.ColorDefault - gui.Views.SearchPrefix.FgColor = gocui.ColorGreen + gui.Views.SearchPrefix.FgColor = gocui.ColorCyan gui.Views.SearchPrefix.Frame = false gui.c.SetViewContent(gui.Views.SearchPrefix, gui.Tr.SearchPrefix) + gui.Views.Search.BgColor = gocui.ColorDefault + gui.Views.Search.FgColor = gocui.ColorCyan + gui.Views.Search.Editable = true + gui.Views.Search.Frame = false gui.Views.Search.Editor = gocui.EditorFunc(gui.searchEditor) gui.Views.Stash.Title = gui.c.Tr.StashTitle @@ -143,11 +147,6 @@ func (gui *Gui) createAllViews() error { gui.Views.Status.Title = gui.c.Tr.StatusTitle - gui.Views.Search.BgColor = gocui.ColorDefault - gui.Views.Search.FgColor = gocui.ColorGreen - gui.Views.Search.Editable = true - gui.Views.Search.Frame = false - gui.Views.AppStatus.BgColor = gocui.ColorDefault gui.Views.AppStatus.FgColor = gocui.ColorCyan gui.Views.AppStatus.Visible = false diff --git a/pkg/theme/theme.go b/pkg/theme/theme.go index bb6ab43de..0a1624029 100644 --- a/pkg/theme/theme.go +++ b/pkg/theme/theme.go @@ -19,6 +19,9 @@ var ( // InactiveBorderColor is the border color of the inactive active frames InactiveBorderColor gocui.Attribute + // FilteredActiveBorderColor is the border color of the active frame, when it's being searched/filtered + SearchingActiveBorderColor gocui.Attribute + // GocuiSelectedLineBgColor is the background color for the selected line in gocui GocuiSelectedLineBgColor gocui.Attribute @@ -44,6 +47,7 @@ var ( func UpdateTheme(themeConfig config.ThemeConfig) { ActiveBorderColor = GetGocuiStyle(themeConfig.ActiveBorderColor) InactiveBorderColor = GetGocuiStyle(themeConfig.InactiveBorderColor) + SearchingActiveBorderColor = GetGocuiStyle(themeConfig.SearchingActiveBorderColor) SelectedLineBgColor = GetTextStyle(themeConfig.SelectedLineBgColor, true) SelectedRangeBgColor = GetTextStyle(themeConfig.SelectedRangeBgColor, true) |