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

Co-authored-by: Ayyan <119342035+ayn2op@users.noreply.github.com>
This commit is contained in:
Thomas Baag 2024-09-21 08:28:02 +02:00 • committed by GitHub
parent d9026d3dd8
commit 7af3035e5a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 17 additions and 4 deletions

View file

@ -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
}

View file

@ -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")

View file

@ -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

View file

@ -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) + " ",
},