theme.go 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. package config
  2. import (
  3. "github.com/ayn2op/tview"
  4. )
  5. type TitleAlign int
  6. func (ta *TitleAlign) UnmarshalTOML(v any) error {
  7. switch v.(string) {
  8. case "left":
  9. *ta = tview.AlignLeft
  10. case "center":
  11. *ta = tview.AlignCenter
  12. case "right":
  13. *ta = tview.AlignRight
  14. }
  15. return nil
  16. }
  17. type (
  18. BorderTheme struct {
  19. Enabled bool `toml:"enabled"`
  20. Padding [4]int `toml:"padding"`
  21. Color string `toml:"color"`
  22. ActiveColor string `toml:"active_color"`
  23. Preset BorderPreset `toml:"preset"`
  24. }
  25. TitleTheme struct {
  26. Color string `toml:"color"`
  27. ActiveColor string `toml:"active_color"`
  28. Align TitleAlign `toml:"align"`
  29. }
  30. Theme struct {
  31. BackgroundColor string `toml:"background_color"`
  32. Title TitleTheme `toml:"title"`
  33. Border BorderTheme `toml:"border"`
  34. GuildsTree GuildsTreeTheme `toml:"guilds_tree"`
  35. MessagesText MessagesTextTheme `toml:"messages_text"`
  36. }
  37. GuildsTreeTheme struct {
  38. AutoExpandFolders bool `toml:"auto_expand_folders"`
  39. Graphics bool `toml:"graphics"`
  40. PrivateChannelColor string `toml:"private_channel_color"`
  41. GuildColor string `toml:"guild_color"`
  42. ChannelColor string `toml:"channel_color"`
  43. }
  44. MessagesTextTheme struct {
  45. ShowNicknames bool `toml:"show_user_nicks"`
  46. ShowUsernameColors bool `toml:"show_user_colors"`
  47. ReplyIndicator string `toml:"reply_indicator"`
  48. ForwardedIndicator string `toml:"forwarded_indicator"`
  49. AuthorColor string `toml:"author_color"`
  50. ContentColor string `toml:"content_color"`
  51. EmojiColor string `toml:"emoji_color"`
  52. LinkColor string `toml:"link_color"`
  53. AttachmentColor string `toml:"attachment_color"`
  54. }
  55. )