Skip to content

Commit e3b58f6

Browse files
authored
feat: theme title foreground (#138)
Add TitleColorFg which is a bit meh but better than a breaking change closes #134
1 parent 218fa2e commit e3b58f6

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ Colors can be hex or ASCII codes, they will be coerced depending on your termina
6464
theme:
6565
glamour: dark
6666
titleColor: "62"
67+
titleColorFg: "231"
6768
selectedItemColor: "170"
6869
filterColor: "#555555"
6970
```

internal/commands/commands.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ func getStyleConfigWithOverrides(theme config.Theme) (sc ansi.StyleConfig) {
284284
}
285285

286286
sc.H1.BackgroundColor = &theme.TitleColor
287+
sc.H1.Color = &theme.TitleColorFg
287288

288289
return sc
289290
}

internal/commands/tui.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,10 @@ func Render(items []list.Item, cmds Commands, errors []string, cfg *config.Confi
157157
l := list.New(items, itemDelegate{theme: cfg.Theme}, defaultWidth, height)
158158
l.SetShowStatusBar(false)
159159
l.Title = defaultTitle
160-
l.Styles.Title = titleStyle.Background(lipgloss.Color(cfg.Theme.TitleColor))
160+
l.Styles.Title = titleStyle.
161+
Background(lipgloss.Color(cfg.Theme.TitleColor)).
162+
Foreground(lipgloss.Color(cfg.Theme.TitleColorFg))
163+
161164
l.Styles.PaginationStyle = paginationStyle
162165
l.Styles.HelpStyle = helpStyle
163166

internal/config/config.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ import (
88
"path/filepath"
99
"strings"
1010

11-
"github.com/guyfedwards/nom/v2/internal/constants"
1211
"gopkg.in/yaml.v3"
12+
13+
"github.com/guyfedwards/nom/v2/internal/constants"
1314
)
1415

1516
var (
@@ -46,6 +47,7 @@ type Opener struct {
4647
type Theme struct {
4748
Glamour string `yaml:"glamour,omitempty"`
4849
TitleColor string `yaml:"titleColor,omitempty"`
50+
TitleColorFg string `yaml:"titleColorFg,omitempty"`
4951
FilterColor string `yaml:"filterColor,omitempty"`
5052
SelectedItemColor string `yaml:"selectedItemColor,omitempty"`
5153
ReadIcon string `yaml:"readIcon,omitempty"`
@@ -111,6 +113,7 @@ func New(configPath string, pager string, previewFeeds []string, version string)
111113
Glamour: "dark",
112114
SelectedItemColor: "170",
113115
TitleColor: "62",
116+
TitleColorFg: "231",
114117
FilterColor: "62",
115118
ReadIcon: "\u2713",
116119
},
@@ -175,6 +178,10 @@ func (c *Config) Load() error {
175178
c.Theme.TitleColor = fileConfig.Theme.TitleColor
176179
}
177180

181+
if fileConfig.Theme.TitleColorFg != "" {
182+
c.Theme.TitleColorFg = fileConfig.Theme.TitleColorFg
183+
}
184+
178185
if fileConfig.Theme.FilterColor != "" {
179186
c.Theme.FilterColor = fileConfig.Theme.FilterColor
180187
}

0 commit comments

Comments
 (0)