From 6b150a4be0e7712d8b8706f10bb80e34094f872b Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Sat, 18 Aug 2018 13:54:39 +1000 Subject: bump dependencies --- pkg/config/app_config.go | 34 +++++++++++++++++++--------------- pkg/gui/gui.go | 4 +++- pkg/gui/theme.go | 12 ++++++++++-- 3 files changed, 32 insertions(+), 18 deletions(-) (limited to 'pkg') diff --git a/pkg/config/app_config.go b/pkg/config/app_config.go index 6276a6afa..9f258d4a6 100644 --- a/pkg/config/app_config.go +++ b/pkg/config/app_config.go @@ -2,8 +2,6 @@ package config import ( "bytes" - "log" - "os/user" "github.com/shibukawa/configdir" "github.com/spf13/viper" @@ -117,7 +115,9 @@ func LoadUserConfigFromFile(v *viper.Viper) error { if folder == nil { // create the file as an empty config and load it folders := configDirs.QueryFolders(configdir.Global) - folders[0].WriteFile("config.yml", []byte{}) + if err := folders[0].WriteFile("config.yml", []byte{}); err != nil { + return err + } folder = configDirs.QueryFolderContainsFile("config.yml") } v.AddConfigPath(folder.Path) @@ -150,11 +150,14 @@ func getDefaultConfig() []byte { gui: ## stuff relating to the UI scrollHeight: 2 - activeBorderColor: - - white - - bold - inactiveBorderColor: - - white + theme: + activeBorderColor: + - white + - bold + inactiveBorderColor: + - white + optionsTextColor: + - blue git: # stuff relating to git os: @@ -163,10 +166,11 @@ func getDefaultConfig() []byte { `) } -func homeDirectory() string { - usr, err := user.Current() - if err != nil { - log.Fatal(err) - } - return usr.HomeDir -} +// // commenting this out until we use it again +// func homeDirectory() string { +// usr, err := user.Current() +// if err != nil { +// log.Fatal(err) +// } +// return usr.HomeDir +// } diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index 71ba255a8..05d0a1ae0 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -231,8 +231,10 @@ func (gui *Gui) layout(g *gocui.Gui) error { if err != gocui.ErrUnknownView { return err } - v.FgColor = gocui.ColorBlue v.Frame = false + if v.FgColor, err = gui.GetOptionsPanelTextColor(); err != nil { + return err + } } if gui.getCommitMessageView(g) == nil { diff --git a/pkg/gui/theme.go b/pkg/gui/theme.go index 25f5f8dc0..dbc8b904b 100644 --- a/pkg/gui/theme.go +++ b/pkg/gui/theme.go @@ -36,10 +36,18 @@ func (gui *Gui) GetColor(keys []string) gocui.Attribute { return attribute } +// GetOptionsPanelTextColor gets the color of the options panel text +func (gui *Gui) GetOptionsPanelTextColor() (gocui.Attribute, error) { + userConfig := gui.Config.GetUserConfig() + optionsColor := userConfig.GetStringSlice("gui.theme.optionsTextColor") + return gui.GetColor(optionsColor), nil +} + // SetColorScheme sets the color scheme for the app based on the user config func (gui *Gui) SetColorScheme() error { - activeBorderColor := gui.Config.GetUserConfig().GetStringSlice("gui.activeBorderColor") - inactiveBorderColor := gui.Config.GetUserConfig().GetStringSlice("gui.inactiveBorderColor") + userConfig := gui.Config.GetUserConfig() + activeBorderColor := userConfig.GetStringSlice("gui.theme.activeBorderColor") + inactiveBorderColor := userConfig.GetStringSlice("gui.theme.inactiveBorderColor") gui.g.FgColor = gui.GetColor(inactiveBorderColor) gui.g.SelFgColor = gui.GetColor(activeBorderColor) return nil -- cgit v1.2.3