Add more Theme configuration
This commit is contained in:
parent
07d431a219
commit
ae058e25c2
4 changed files with 37 additions and 13 deletions
40
config.go
40
config.go
|
|
@ -8,20 +8,33 @@ import (
|
|||
|
||||
const name = "discordo"
|
||||
|
||||
type ThemeConfig struct {
|
||||
BorderPadding [4]int
|
||||
type GuildsTreeThemeConfig struct {
|
||||
Border bool
|
||||
Graphics bool
|
||||
}
|
||||
|
||||
type GuildsTreeKeysConfig struct {
|
||||
Graphics bool
|
||||
type MessagesTextThemeConfig struct {
|
||||
Border bool
|
||||
}
|
||||
|
||||
type MessageInputThemeConfig struct {
|
||||
Border bool
|
||||
}
|
||||
|
||||
type ThemeConfig struct {
|
||||
BorderPadding [4]int
|
||||
|
||||
GuildsTree GuildsTreeThemeConfig
|
||||
MessagesText MessagesTextThemeConfig
|
||||
MessageInput MessageInputThemeConfig
|
||||
}
|
||||
|
||||
type MessagesTextKeysConfig struct {
|
||||
SelectPreviousMessage string
|
||||
SelectNextMessage string
|
||||
}
|
||||
|
||||
type KeysConfig struct {
|
||||
GuildsTree GuildsTreeKeysConfig
|
||||
MessagesText MessagesTextKeysConfig
|
||||
}
|
||||
|
||||
|
|
@ -50,10 +63,23 @@ func newConfig() (*Config, error) {
|
|||
|
||||
Theme: ThemeConfig{
|
||||
BorderPadding: [...]int{1, 1, 1, 1},
|
||||
|
||||
GuildsTree: GuildsTreeThemeConfig{
|
||||
Border: true,
|
||||
Graphics: true,
|
||||
},
|
||||
MessagesText: MessagesTextThemeConfig{
|
||||
Border: true,
|
||||
},
|
||||
MessageInput: MessageInputThemeConfig{
|
||||
Border: true,
|
||||
},
|
||||
},
|
||||
Keys: KeysConfig{
|
||||
GuildsTree: GuildsTreeKeysConfig{Graphics: true},
|
||||
MessagesText: MessagesTextKeysConfig{SelectPreviousMessage: "Up"},
|
||||
MessagesText: MessagesTextKeysConfig{
|
||||
SelectPreviousMessage: "Up",
|
||||
SelectNextMessage: "Down",
|
||||
},
|
||||
},
|
||||
}
|
||||
path = filepath.Join(path, "config.json")
|
||||
|
|
|
|||
|
|
@ -22,13 +22,12 @@ func newGuildsTree() *GuildsTree {
|
|||
root: tview.NewTreeNode(""),
|
||||
}
|
||||
|
||||
gt.SetGraphics(cfg.Keys.GuildsTree.Graphics)
|
||||
gt.SetGraphics(cfg.Theme.GuildsTree.Graphics)
|
||||
gt.SetRoot(gt.root)
|
||||
gt.SetTopLevel(1)
|
||||
gt.SetSelectedFunc(gt.onSelected)
|
||||
|
||||
gt.SetTitle("Guilds")
|
||||
gt.SetBorder(true)
|
||||
gt.SetBorder(cfg.Theme.GuildsTree.Border)
|
||||
gt.SetBorderPadding(cfg.BorderPadding())
|
||||
|
||||
return gt
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ func newMessageInput() *MessageInput {
|
|||
InputField: tview.NewInputField(),
|
||||
}
|
||||
|
||||
mi.SetBorder(true)
|
||||
mi.SetBorder(cfg.Theme.MessageInput.Border)
|
||||
mi.SetBorderPadding(cfg.BorderPadding())
|
||||
|
||||
return mi
|
||||
|
|
|
|||
|
|
@ -23,8 +23,7 @@ func newMessagesText() *MessagesText {
|
|||
mt.SetRegions(true)
|
||||
mt.SetWordWrap(true)
|
||||
|
||||
mt.SetTitle("Messages")
|
||||
mt.SetBorder(true)
|
||||
mt.SetBorder(cfg.Theme.MessagesText.Border)
|
||||
mt.SetBorderPadding(cfg.BorderPadding())
|
||||
|
||||
return mt
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue