summaryrefslogtreecommitdiff
path: root/app.go
diff options
context:
space:
mode:
authordelthas <delthas@dille.cc>2022-08-15 15:57:06 +0200
committerdelthas <delthas@dille.cc>2022-08-15 15:57:06 +0200
commitf23dd3273dd29a32c7c759aab0fb34a3784bd5d0 (patch)
tree55bb578a8420a1ec8422ad54f709b973cc5744c4 /app.go
parentAdd a project description (diff)
Revert to using base colors by default, making extended configurable
In a previous commit, the color scheme for displaying nicks was changed to use more colors (30 rather than 14), using extended colors from the 256 colors set. The issue with this is that most terminal emulators customize the colors of the first 16 colors to make them more readable (eg, a terminal emulator with a light theme will make colors darker, and one with a dark theme will make colors lighter). So the 14 colors used before were usually not the default color codes from the original xterm/X11 spec, but specific colors chosen by the terminal emulator to be particularly readable. In a way, changing the behavior to use colors from the 256 colors set, which is usually not overriden, made them much less readable. Which is why we need a configuration option for this. I conversatively chose to make the default color scheme the previous one, with only the base 16 colors. The 256 colors scheme can be enable by adding to the configuration file: colors { nicks extended }
Diffstat (limited to 'app.go')
-rw-r--r--app.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/app.go b/app.go
index 8b18238..35cc3b8 100644
--- a/app.go
+++ b/app.go
@@ -144,6 +144,7 @@ func NewApp(cfg Config) (app *App, err error) {
},
Colors: ui.ConfigColors{
Unread: cfg.Colors.Unread,
+ Nicks: cfg.Colors.Nicks,
},
})
if err != nil {
@@ -1259,7 +1260,7 @@ func (app *App) formatMessage(s *irc.Session, ev irc.MessageEvent) (buffer strin
if isAction || isNotice {
head = "*"
} else {
- headColor = ui.IdentColor(head)
+ headColor = ui.IdentColor(app.cfg.Colors.Nicks, head)
}
content := strings.TrimSuffix(ev.Content, "\x01")
@@ -1269,14 +1270,14 @@ func (app *App) formatMessage(s *irc.Session, ev irc.MessageEvent) (buffer strin
}
var body ui.StyledStringBuilder
if isNotice {
- color := ui.IdentColor(ev.User)
+ color := ui.IdentColor(app.cfg.Colors.Nicks, ev.User)
body.SetStyle(tcell.StyleDefault.Foreground(color))
body.WriteString(ev.User)
body.SetStyle(tcell.StyleDefault)
body.WriteString(": ")
body.WriteStyledString(ui.IRCString(content))
} else if isAction {
- color := ui.IdentColor(ev.User)
+ color := ui.IdentColor(app.cfg.Colors.Nicks, ev.User)
body.SetStyle(tcell.StyleDefault.Foreground(color))
body.WriteString(ev.User)
body.SetStyle(tcell.StyleDefault)
@@ -1416,7 +1417,7 @@ func (app *App) updatePrompt() {
Foreground(tcell.ColorRed),
)
} else {
- prompt = ui.IdentString(s.Nick())
+ prompt = ui.IdentString(app.cfg.Colors.Nicks, s.Nick())
}
app.win.SetPrompt(prompt)
}