diff options
| author | Hubert Hirtz <hubert@hirtzfr.eu> | 2020-08-21 18:51:43 +0200 |
|---|---|---|
| committer | Hubert Hirtz <hubert@hirtzfr.eu> | 2020-08-21 18:51:56 +0200 |
| commit | 34122cde75b8d0b7b7e8b3008755d8e48657ef52 (patch) | |
| tree | b069cc4608b9acf5c9b3a3b38b1e3957fa19333a | |
| parent | ui: Fix color codes (diff) | |
ui: Blacklist dark colors for nicks
Diffstat (limited to '')
| -rw-r--r-- | ui/buffers.go | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/ui/buffers.go b/ui/buffers.go index 21f2e08..f3605a6 100644 --- a/ui/buffers.go +++ b/ui/buffers.go @@ -604,16 +604,18 @@ func printTime(screen tcell.Screen, x int, y int, st tcell.Style, t time.Time) { screen.SetContent(x+4, y, mn1, nil, st) } +// see <https://modern.ircdocs.horse/formatting.html> +var identColorBlacklist = []int{1, 8, 16, 27, 28, 88, 89, 90, 91} + func identColor(s string) (code int) { h := fnv.New32() _, _ = h.Write([]byte(s)) - code = int(h.Sum32()) % 96 - if 1 <= code { - code++ - } - if 8 <= code { - code++ + code = int(h.Sum32()) % (99 - len(identColorBlacklist)) + for _, c := range identColorBlacklist { + if c <= code { + code++ + } } return |
