parent
8a6392bace
commit
e4d9a3fb0a
4 changed files with 35 additions and 63 deletions
53
README.md
53
README.md
|
|
@ -62,58 +62,7 @@ The configuration file allows you to configure and customize the behavior, keybi
|
|||
- Darwin: `$HOME/Library/Application Support/discordo/config.toml`
|
||||
- Windows: `%AppData%/discordo/config.toml`
|
||||
|
||||
```toml
|
||||
mouse = true
|
||||
hide_blocked_users = true
|
||||
messages_limit = 50
|
||||
editor = "default"
|
||||
|
||||
timestamps = false
|
||||
timestamps_before_author = false
|
||||
timestamps_format = "3:04PM"
|
||||
|
||||
[keys]
|
||||
focus_guilds_tree = "Ctrl+G"
|
||||
focus_messages_text = "Ctrl+T"
|
||||
focus_message_input = "Ctrl+P"
|
||||
toggle_guild_tree = "Ctrl+B"
|
||||
select_previous = "Rune[k]"
|
||||
select_next = "Rune[j]"
|
||||
select_first = "Rune[g]"
|
||||
select_last = "Rune[G]"
|
||||
|
||||
[keys.guilds_tree]
|
||||
select_current = "Enter"
|
||||
|
||||
[keys.messages_text]
|
||||
select_reply = "Rune[s]"
|
||||
reply = "Rune[r]"
|
||||
reply_mention = "Rune[R]"
|
||||
delete = "Rune[d]"
|
||||
yank = "Rune[y]"
|
||||
open = "Rune[o]"
|
||||
|
||||
[keys.message_input]
|
||||
send = "Enter"
|
||||
editor = "Ctrl+E"
|
||||
cancel = "Esc"
|
||||
|
||||
[theme]
|
||||
border = true
|
||||
border_color = "default"
|
||||
border_padding = [0, 0, 1, 1]
|
||||
title_color = "default"
|
||||
background_color = "default"
|
||||
|
||||
[theme.guilds_tree]
|
||||
auto_expand_folders = true
|
||||
graphics = true
|
||||
|
||||
[theme.messages_text]
|
||||
author_color = "aqua"
|
||||
emoji_color = "green"
|
||||
reply_indicator = "╭ "
|
||||
```
|
||||
[The default configuration can be found here](./internal/config/config.go).
|
||||
|
||||
## Disclaimer
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,10 @@ func newMessagesText() *MessagesText {
|
|||
mt.SetBorderColor(tcell.GetColor(cfg.Theme.BorderColor))
|
||||
mt.SetBorderPadding(p[0], p[1], p[2], p[3])
|
||||
|
||||
markdown.DefaultRenderer.AddOptions(renderer.WithOption("emojiColor", cfg.Theme.MessagesText.EmojiColor))
|
||||
markdown.DefaultRenderer.AddOptions(
|
||||
renderer.WithOption("emojiColor", cfg.Theme.MessagesText.EmojiColor),
|
||||
renderer.WithOption("linkColor", cfg.Theme.MessagesText.LinkColor),
|
||||
)
|
||||
|
||||
return mt
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,10 +24,12 @@ type (
|
|||
}
|
||||
|
||||
MessagesTextTheme struct {
|
||||
AuthorColor string `toml:"author_color"`
|
||||
ContentColor string `toml:"content_color"`
|
||||
EmojiColor string `toml:"emoji_color"`
|
||||
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"`
|
||||
}
|
||||
)
|
||||
|
||||
|
|
@ -48,10 +50,12 @@ func defaultTheme() Theme {
|
|||
PrivateChannelColor: tview.Styles.PrimaryTextColor.String(),
|
||||
},
|
||||
MessagesText: MessagesTextTheme{
|
||||
AuthorColor: "aqua",
|
||||
ContentColor: tview.Styles.PrimaryTextColor.String(),
|
||||
EmojiColor: "green",
|
||||
ReplyIndicator: string(tview.BoxDrawingsLightArcDownAndRight) + " ",
|
||||
|
||||
AuthorColor: "aqua",
|
||||
ContentColor: tview.Styles.PrimaryTextColor.String(),
|
||||
EmojiColor: "green",
|
||||
LinkColor: "blue",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ func (r *renderer) Render(w io.Writer, source []byte, n ast.Node) error {
|
|||
switch n := n.(type) {
|
||||
case *ast.Document:
|
||||
// noop
|
||||
case *ast.Heading:
|
||||
io.WriteString(w, "\n")
|
||||
case *ast.FencedCodeBlock:
|
||||
io.WriteString(w, "\n")
|
||||
|
||||
|
|
@ -45,16 +47,30 @@ func (r *renderer) Render(w io.Writer, source []byte, n ast.Node) error {
|
|||
w.Write(line.Value(source))
|
||||
}
|
||||
}
|
||||
case *ast.AutoLink:
|
||||
if entering {
|
||||
linkColor := r.config.Options["linkColor"].(string)
|
||||
io.WriteString(w, "["+linkColor+"]")
|
||||
w.Write(n.URL(source))
|
||||
} else {
|
||||
io.WriteString(w, "[-::]")
|
||||
}
|
||||
case *ast.Link:
|
||||
if entering {
|
||||
io.WriteString(w, fmt.Sprintf("[:::%s]", n.Destination))
|
||||
linkColor := r.config.Options["linkColor"].(string)
|
||||
io.WriteString(w, fmt.Sprintf("[%s:::%s]", linkColor, n.Destination))
|
||||
} else {
|
||||
io.WriteString(w, "[:::-]")
|
||||
io.WriteString(w, "[-:::-]")
|
||||
}
|
||||
case *ast.Text:
|
||||
if entering {
|
||||
value := n.Segment.Value(source)
|
||||
w.Write(value)
|
||||
w.Write(n.Segment.Value(source))
|
||||
switch {
|
||||
case n.HardLineBreak():
|
||||
io.WriteString(w, "\n\n")
|
||||
case n.SoftLineBreak():
|
||||
io.WriteString(w, "\n")
|
||||
}
|
||||
}
|
||||
|
||||
case *discordmd.Inline:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue