Skip to content

Commit

Permalink
Add three theme options
Browse files Browse the repository at this point in the history
- Make title color options separate from border color options
- Add option to change title color of selected tabs in inactive views
  • Loading branch information
oliviaBahr committed Apr 27, 2024
1 parent 34f8f72 commit 6390b05
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 12 deletions.
7 changes: 7 additions & 0 deletions docs/Config.md
Expand Up @@ -53,6 +53,13 @@ gui:
searchingActiveBorderColor:
- cyan
- bold
activeTitleColor:
- green
- bold
inactiveTitleColor:
- default
inactiveSelTabTitleColor: # style of 'current tab' title in inactive views
- default # 'default' is activeTitleColor without bold
optionsTextColor:
- blue
selectedLineBgColor:
Expand Down
9 changes: 9 additions & 0 deletions pkg/config/user_config.go
Expand Up @@ -161,6 +161,12 @@ type ThemeConfig struct {
ActiveBorderColor []string `yaml:"activeBorderColor" jsonschema:"minItems=1,uniqueItems=true"`
// Border color of non-focused windows
InactiveBorderColor []string `yaml:"inactiveBorderColor" jsonschema:"minItems=1,uniqueItems=true"`
// Title color of focused window
ActiveTitleColor []string `yaml:"activeTitleColor" jsonschema:"minItems=1,uniqueItems=true"`
// Title color of non-focused window
InactiveTitleColor []string `yaml:"inactiveTitleColor" jsonschema:"minItems=1,uniqueItems=true"`
// Title color of selected tab in non-focused window
InactiveSelTabTitleColor []string `yaml:"inactiveSelTabTitleColor" jsonschema:"minItems=1,uniqueItems=true"`
// Border color of focused window when searching in that window
SearchingActiveBorderColor []string `yaml:"searchingActiveBorderColor" jsonschema:"minItems=1,uniqueItems=true"`
// Color of keybindings help text in the bottom line
Expand Down Expand Up @@ -655,6 +661,9 @@ func GetDefaultConfig() *UserConfig {
ActiveBorderColor: []string{"green", "bold"},
SearchingActiveBorderColor: []string{"cyan", "bold"},
InactiveBorderColor: []string{"default"},
ActiveTitleColor: []string{"green", "bold"},
InactiveTitleColor: []string{"default"},
InactiveSelTabTitleColor: []string{"default"},
OptionsTextColor: []string{"blue"},
SelectedLineBgColor: []string{"blue"},
CherryPickedCommitBgColor: []string{"cyan"},
Expand Down
2 changes: 1 addition & 1 deletion pkg/gui/controllers/helpers/search_helper.go
Expand Up @@ -295,6 +295,6 @@ func (self *SearchHelper) setSearchingFrameColor() {
}

func (self *SearchHelper) setNonSearchingFrameColor() {
self.c.GocuiGui().SelFgColor = theme.ActiveBorderColor
self.c.GocuiGui().SelFgColor = theme.ActiveTitleColor
self.c.GocuiGui().SelFrameColor = theme.ActiveBorderColor
}
5 changes: 3 additions & 2 deletions pkg/gui/gui.go
Expand Up @@ -944,8 +944,9 @@ func (gui *Gui) setColorScheme() error {
userConfig := gui.UserConfig
theme.UpdateTheme(userConfig.Gui.Theme)

gui.g.FgColor = theme.InactiveBorderColor
gui.g.SelFgColor = theme.ActiveBorderColor
gui.g.FgColor = theme.InactiveTitleColor
gui.g.SelFgColor = theme.ActiveTitleColor
gui.g.InactiveSelFgColor = theme.InactiveSelTabTitleColor
gui.g.FrameColor = theme.InactiveBorderColor
gui.g.SelFrameColor = theme.ActiveBorderColor

Expand Down
12 changes: 12 additions & 0 deletions pkg/theme/theme.go
Expand Up @@ -19,6 +19,15 @@ var (
// InactiveBorderColor is the border color of the inactive active frames
InactiveBorderColor gocui.Attribute

// ActiveTitleColor is the foreground color of the active view title
ActiveTitleColor gocui.Attribute

// InactiveTitleColor is the foreground color of the inactive view titles
InactiveTitleColor gocui.Attribute

// InactiveSelTabTitleColor is the foreground color of title of 'current' tab in inactive views
InactiveSelTabTitleColor gocui.Attribute

// FilteredActiveBorderColor is the border color of the active frame, when it's being searched/filtered
SearchingActiveBorderColor gocui.Attribute

Expand Down Expand Up @@ -47,6 +56,9 @@ var (
func UpdateTheme(themeConfig config.ThemeConfig) {
ActiveBorderColor = GetGocuiStyle(themeConfig.ActiveBorderColor)
InactiveBorderColor = GetGocuiStyle(themeConfig.InactiveBorderColor)
ActiveTitleColor = GetGocuiStyle(themeConfig.ActiveTitleColor)
InactiveTitleColor = GetGocuiStyle(themeConfig.InactiveTitleColor)
InactiveSelTabTitleColor = GetGocuiStyle(themeConfig.InactiveSelTabTitleColor)
SearchingActiveBorderColor = GetGocuiStyle(themeConfig.SearchingActiveBorderColor)
SelectedLineBgColor = GetTextStyle(themeConfig.SelectedLineBgColor, true)

Expand Down
37 changes: 37 additions & 0 deletions schema/config.json
Expand Up @@ -139,6 +139,43 @@
"default"
]
},
"activeTitleColor": {
"items": {
"type": "string"
},
"type": "array",
"minItems": 1,
"uniqueItems": true,
"description": "Title color of focused window",
"default": [
"blue",
"bold"
]
},
"inactiveTitleColor": {
"items": {
"type": "string"
},
"type": "array",
"minItems": 1,
"uniqueItems": true,
"description": "Title color of non-focused window",
"default": [
"default"
]
},
"inactiveSelTabTitleColor": {
"items": {
"type": "string"
},
"type": "array",
"minItems": 1,
"uniqueItems": true,
"description": "Title color of selected tab in non-focused window",
"default": [
"default"
]
},
"searchingActiveBorderColor": {
"items": {
"type": "string"
Expand Down
24 changes: 15 additions & 9 deletions vendor/github.com/jesseduffield/gocui/gui.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6390b05

Please sign in to comment.