Browse Source

feat(config): add theme.active_title_color field

ayn2op 1 năm trước cách đây
mục cha
commit
5932b66e53
5 tập tin đã thay đổi với 21 bổ sung10 xóa
  1. 2 0
      cmd/guilds_tree.go
  2. 2 0
      cmd/message_input.go
  3. 2 0
      cmd/messages_text.go
  4. 0 1
      cmd/root.go
  5. 15 9
      internal/config/theme.go

+ 2 - 0
cmd/guilds_tree.go

@@ -45,9 +45,11 @@ func newGuildsTree(app *tview.Application, cfg *config.Config) *GuildsTree {
 		SetBorderPadding(p[0], p[1], p[2], p[3]).
 		SetFocusFunc(func() {
 			gt.SetBorderColor(tcell.GetColor(b.ActiveColor))
+			gt.SetTitleColor(tcell.GetColor(t.ActiveTitleColor))
 		}).
 		SetBlurFunc(func() {
 			gt.SetBorderColor(tcell.GetColor(b.Color))
+			gt.SetTitleColor(tcell.GetColor(t.TitleColor))
 		})
 
 	return gt

+ 2 - 0
cmd/message_input.go

@@ -51,9 +51,11 @@ func newMessageInput(app *tview.Application, cfg *config.Config) *MessageInput {
 		SetBorderPadding(p[0], p[1], p[2], p[3]).
 		SetFocusFunc(func() {
 			mi.SetBorderColor(tcell.GetColor(b.ActiveColor))
+			mi.SetTitleColor(tcell.GetColor(t.ActiveTitleColor))
 		}).
 		SetBlurFunc(func() {
 			mi.SetBorderColor(tcell.GetColor(b.Color))
+			mi.SetTitleColor(tcell.GetColor(t.TitleColor))
 		})
 
 	return mi

+ 2 - 0
cmd/messages_text.go

@@ -60,9 +60,11 @@ func newMessagesText(app *tview.Application, cfg *config.Config) *MessagesText {
 		SetBorderPadding(p[0], p[1], p[2], p[3]).
 		SetFocusFunc(func() {
 			mt.SetBorderColor(tcell.GetColor(b.ActiveColor))
+			mt.SetTitleColor(tcell.GetColor(t.ActiveTitleColor))
 		}).
 		SetBlurFunc(func() {
 			mt.SetBorderColor(tcell.GetColor(b.Color))
+			mt.SetTitleColor(tcell.GetColor(t.TitleColor))
 		})
 
 	markdown.DefaultRenderer.AddOptions(

+ 0 - 1
cmd/root.go

@@ -39,7 +39,6 @@ var (
 			}
 
 			tview.Styles.PrimitiveBackgroundColor = tcell.GetColor(cfg.Theme.BackgroundColor)
-			tview.Styles.TitleColor = tcell.GetColor(cfg.Theme.TitleColor)
 
 			tview.Borders.Horizontal = cfg.Theme.Border.Preset.Horizontal
 			tview.Borders.Vertical = cfg.Theme.Border.Preset.Vertical

+ 15 - 9
internal/config/theme.go

@@ -61,17 +61,21 @@ type (
 		Enabled bool   `toml:"enabled"`
 		Padding [4]int `toml:"padding"`
 
-		Color       string       `toml:"color"`
-		ActiveColor string       `toml:"active_color"`
-		Preset      BorderPreset `toml:"preset"`
+		Color       string `toml:"color"`
+		ActiveColor string `toml:"active_color"`
+
+		Preset BorderPreset `toml:"preset"`
 	}
 
 	Theme struct {
-		TitleColor      string            `toml:"title_color"`
-		BackgroundColor string            `toml:"background_color"`
-		Border          BorderTheme       `toml:"border"`
-		GuildsTree      GuildsTreeTheme   `toml:"guilds_tree"`
-		MessagesText    MessagesTextTheme `toml:"messages_text"`
+		BackgroundColor string `toml:"background_color"`
+
+		TitleColor       string `toml:"title_color"`
+		ActiveTitleColor string `toml:"active_title_color"`
+
+		Border       BorderTheme       `toml:"border"`
+		GuildsTree   GuildsTreeTheme   `toml:"guilds_tree"`
+		MessagesText MessagesTextTheme `toml:"messages_text"`
 	}
 
 	GuildsTreeTheme struct {
@@ -113,7 +117,9 @@ func defaultTheme() Theme {
 		},
 
 		BackgroundColor: "default",
-		TitleColor:      "default",
+
+		TitleColor:       "default",
+		ActiveTitleColor: "green",
 
 		GuildsTree: GuildsTreeTheme{
 			AutoExpandFolders:   true,