| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- package config
- import (
- "github.com/rivo/tview"
- )
- type BorderPreset struct {
- Horizontal rune
- Vertical rune
- TopLeft rune
- TopRight rune
- BottomLeft rune
- BottomRight rune
- }
- func (p *BorderPreset) UnmarshalTOML(v any) error {
- switch v.(string) {
- case "double":
- *p = BorderPreset{
- Horizontal: tview.BoxDrawingsDoubleHorizontal,
- Vertical: tview.BoxDrawingsDoubleVertical,
- TopLeft: tview.BoxDrawingsDoubleDownAndRight,
- TopRight: tview.BoxDrawingsDoubleDownAndLeft,
- BottomLeft: tview.BoxDrawingsDoubleUpAndRight,
- BottomRight: tview.BoxDrawingsDoubleUpAndLeft,
- }
- case "thick":
- *p = BorderPreset{
- Horizontal: tview.BoxDrawingsHeavyHorizontal,
- Vertical: tview.BoxDrawingsHeavyVertical,
- TopLeft: tview.BoxDrawingsHeavyDownAndRight,
- TopRight: tview.BoxDrawingsHeavyDownAndLeft,
- BottomLeft: tview.BoxDrawingsHeavyUpAndRight,
- BottomRight: tview.BoxDrawingsHeavyUpAndLeft,
- }
- case "round":
- *p = BorderPreset{
- Horizontal: tview.BoxDrawingsLightHorizontal,
- Vertical: tview.BoxDrawingsLightVertical,
- TopLeft: tview.BoxDrawingsLightArcDownAndRight,
- TopRight: tview.BoxDrawingsLightArcDownAndLeft,
- BottomLeft: tview.BoxDrawingsLightArcUpAndRight,
- BottomRight: tview.BoxDrawingsLightArcUpAndLeft,
- }
- case "hidden":
- *p = BorderPreset{
- Horizontal: ' ',
- Vertical: ' ',
- TopLeft: ' ',
- TopRight: ' ',
- BottomLeft: ' ',
- BottomRight: ' ',
- }
- }
- return nil
- }
- type (
- BorderTheme struct {
- Enabled bool `toml:"enabled"`
- Padding [4]int `toml:"padding"`
- Color string `toml:"color"`
- ActiveColor string `toml:"active_color"`
- Preset BorderPreset `toml:"preset"`
- }
- Theme struct {
- Border BorderTheme `toml:"border"`
- TitleColor string `toml:"title_color"`
- BackgroundColor string `toml:"background_color"`
- GuildsTree GuildsTreeTheme `toml:"guilds_tree"`
- MessagesText MessagesTextTheme `toml:"messages_text"`
- }
- GuildsTreeTheme struct {
- 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 {
- ReplyIndicator string `toml:"reply_indicator"`
- AuthorColor string `toml:"author_color"`
- ContentColor string `toml:"content_color"`
- EmojiColor string `toml:"emoji_color"`
- LinkColor string `toml:"link_color"`
- AttachmentColor string `toml:"attachment_color"`
- }
- )
- func defaultTheme() Theme {
- return Theme{
- Border: BorderTheme{
- Enabled: true,
- Padding: [...]int{0, 0, 1, 1},
- Color: "default",
- ActiveColor: "gold",
- Preset: BorderPreset{
- Horizontal: tview.Borders.Horizontal,
- Vertical: tview.Borders.Vertical,
- TopLeft: tview.Borders.TopLeft,
- TopRight: tview.Borders.TopRight,
- BottomLeft: tview.Borders.BottomLeft,
- BottomRight: tview.Borders.BottomRight,
- },
- },
- BackgroundColor: "default",
- TitleColor: "default",
- GuildsTree: GuildsTreeTheme{
- AutoExpandFolders: true,
- ChannelColor: tview.Styles.PrimaryTextColor.String(),
- Graphics: true,
- GuildColor: tview.Styles.PrimaryTextColor.String(),
- PrivateChannelColor: tview.Styles.PrimaryTextColor.String(),
- },
- MessagesText: MessagesTextTheme{
- ReplyIndicator: string(tview.BoxDrawingsLightArcDownAndRight) + " ",
- AuthorColor: "aqua",
- ContentColor: tview.Styles.PrimaryTextColor.String(),
- EmojiColor: "green",
- LinkColor: "blue",
- AttachmentColor: "yellow",
- },
- }
- }
|