Pārlūkot izejas kodu

feat(config): add more theme configuration for UI elements (#424)

Co-authored-by: Ayyan <119342035+ayn2op@users.noreply.github.com>
Thomas Baag 1 gadu atpakaļ
vecāks
revīzija
7af3035e5a
4 mainītis faili ar 17 papildinājumiem un 4 dzēšanām
  1. 2 0
      cmd/guilds_tree.go
  2. 1 0
      cmd/messages_text.go
  3. 2 0
      cmd/state.go
  4. 12 4
      internal/config/theme.go

+ 2 - 0
cmd/guilds_tree.go

@@ -73,6 +73,7 @@ func (gt *GuildsTree) createFolderNode(folder gateway.GuildFolder) {
 func (gt *GuildsTree) createGuildNode(n *tview.TreeNode, g discord.Guild) {
 	guildNode := tview.NewTreeNode(g.Name)
 	guildNode.SetReference(g.ID)
+	guildNode.SetColor(tcell.GetColor(cfg.Theme.GuildsTree.GuildColor))
 	n.AddChild(guildNode)
 }
 
@@ -124,6 +125,7 @@ func (gt *GuildsTree) createChannelNode(n *tview.TreeNode, c discord.Channel) *t
 
 	channelNode := tview.NewTreeNode(gt.channelToString(c))
 	channelNode.SetReference(c.ID)
+	channelNode.SetColor(tcell.GetColor(cfg.Theme.GuildsTree.ChannelColor))
 	n.AddChild(channelNode)
 	return channelNode
 }

+ 1 - 0
cmd/messages_text.go

@@ -39,6 +39,7 @@ func newMessagesText() *MessagesText {
 		app.Draw()
 	})
 
+	mt.SetTextColor(tcell.GetColor(cfg.Theme.MessagesText.ContentColor))
 	mt.SetBackgroundColor(tcell.GetColor(cfg.Theme.BackgroundColor))
 
 	mt.SetTitle("Messages")

+ 2 - 0
cmd/state.go

@@ -12,6 +12,7 @@ import (
 	"github.com/diamondburned/arikawa/v3/gateway"
 	"github.com/diamondburned/arikawa/v3/utils/httputil/httpdriver"
 	"github.com/diamondburned/ningen/v3"
+	"github.com/gdamore/tcell/v2"
 	"github.com/rivo/tview"
 )
 
@@ -54,6 +55,7 @@ func (s *State) onRequest(r httpdriver.Request) error {
 func (s *State) onReady(r *gateway.ReadyEvent) {
 	root := mainFlex.guildsTree.GetRoot()
 	dmNode := tview.NewTreeNode("Direct Messages")
+	dmNode.SetColor(tcell.GetColor(cfg.Theme.GuildsTree.PrivateChannelColor))
 	root.AddChild(dmNode)
 
 	// Track guilds that have a parent (folder) to add orphan channels later

+ 12 - 4
internal/config/theme.go

@@ -16,12 +16,16 @@ type (
 	}
 
 	GuildsTreeTheme struct {
-		AutoExpandFolders bool `toml:"auto_expand_folders"`
-		Graphics          bool `toml:"graphics"`
+		AutoExpandFolders   bool   `toml:"auto_expand_folders"`
+		ChannelColor        string `toml:"channel_color"`
+		Graphics            bool   `toml:"graphics"`
+		GuildColor          string `toml:"guild_color"`
+		PrivateChannelColor string `toml:"private_channel_color"`
 	}
 
 	MessagesTextTheme struct {
 		AuthorColor     string `toml:"author_color"`
+    		ContentColor    string `toml:"content_color"`
 		EmoteColor      string `toml:"emote_color"`
 		ReplyIndicator  string `toml:"reply_indicator"`
 	}
@@ -37,11 +41,15 @@ func defaultTheme() Theme {
 		TitleColor:      "default",
 
 		GuildsTree: GuildsTreeTheme{
-			AutoExpandFolders: true,
-			Graphics:          true,
+			AutoExpandFolders:   true,
+			ChannelColor:        tview.Styles.PrimaryTextColor.String(),
+			Graphics:            true,
+			GuildColor:          tview.Styles.PrimaryTextColor.String(),
+			PrivateChannelColor: tview.Styles.PrimaryTextColor.String(),
 		},
 		MessagesText: MessagesTextTheme{
 			AuthorColor:        "aqua",
+      			ContentColor:       tview.Styles.PrimaryTextColor.String(),
 			EmoteColor:         "green",
 			ReplyIndicator:     string(tview.BoxDrawingsLightArcDownAndRight) + " ",
 		},