summaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2018-08-18 13:54:39 +1000
committerJesse Duffield <jessedduffield@gmail.com>2018-08-18 14:20:19 +1000
commit6b150a4be0e7712d8b8706f10bb80e34094f872b (patch)
tree68d351bdac16e9b1d1dddfe2f1b1908c39604a8e /pkg
parent284c53425102dba89164aa4363441caf71402114 (diff)
bump dependencies
Diffstat (limited to 'pkg')
-rw-r--r--pkg/config/app_config.go34
-rw-r--r--pkg/gui/gui.go4
-rw-r--r--pkg/gui/theme.go12
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