diff options
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/config/app_config.go | 34 | ||||
-rw-r--r-- | pkg/gui/gui.go | 4 | ||||
-rw-r--r-- | pkg/gui/theme.go | 12 |
3 files changed, 32 insertions, 18 deletions
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 |