commit 2f292ee
delthas
·
2025-03-07 11:15:45 +0000 UTC
parent c388b84
Add "colors nicks self" to set own nick color only Fixes: https://todo.sr.ht/~delthas/senpai/195
3 files changed,
+16,
-4
+8,
-1
1@@ -155,7 +155,6 @@ func Defaults() Config {
2 Nicks: ui.ColorScheme{
3 Type: ui.ColorSchemeBase,
4 Others: ui.ColorDefault,
5- Self: ui.ColorRed,
6 },
7 },
8 Debug: false,
9@@ -399,6 +398,14 @@ func unmarshal(filename string, cfg *Config) (err error) {
10 return err
11 }
12 }
13+ case "self":
14+ var selfStr string
15+ if err := child.ParseParams(nil, &selfStr); err != nil {
16+ return err
17+ }
18+ if err = parseColor(selfStr, &cfg.Colors.Nicks.Self); err != nil {
19+ return err
20+ }
21 default:
22 return fmt.Errorf("unknown nick color scheme %q", colorStr)
23 }
+4,
-2
1@@ -195,8 +195,10 @@ colors {
2 : show nicks with 16 different colors (default)
3 | nicks extended
4 : show nicks with 256 different colors
5-| nicks fixed [<others> [self]]
6-: show nicks with a fixed color, optionally specifying the colors for other nicks, and self
7+| nicks fixed [<others>]
8+: show nicks with a fixed color, optionally specifying the colors for other nicks
9+| nicks self <self>
10+: show self nick with a fixed specified color
11
12 *debug*
13 Advanced.
+4,
-1
1@@ -68,12 +68,15 @@ func hslToRGB(hue, sat, light float64) (r, g, b uint8) {
2 }
3
4 func (ui *UI) IdentColor(scheme ColorScheme, ident string, self bool) vaxis.Color {
5+ if self && scheme.Self != 0 {
6+ return scheme.Self
7+ }
8 h := fnv.New32()
9 _, _ = h.Write([]byte(ident))
10 switch scheme.Type {
11 case ColorSchemeFixed:
12 if self {
13- return scheme.Self
14+ return ColorRed
15 } else {
16 return scheme.Others
17 }