Skip to content

Commit 7461ca8

Browse files
committed
chat/message: Use user.ID() names for mono bot theme
1 parent 53ae43f commit 7461ca8

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

chat/message/theme.go

+11-3
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ type Theme struct {
122122
pm Style
123123
highlight Style
124124
names *Palette
125+
useID bool
125126
}
126127

127128
func (theme Theme) ID() string {
@@ -130,11 +131,17 @@ func (theme Theme) ID() string {
130131

131132
// Colorize name string given some index
132133
func (theme Theme) ColorName(u *User) string {
134+
var name string
135+
if theme.useID {
136+
name = u.ID()
137+
} else {
138+
name = u.Name()
139+
}
133140
if theme.names == nil {
134-
return u.Name()
141+
return name
135142
}
136143

137-
return theme.names.Get(u.colorIdx).Format(u.Name())
144+
return theme.names.Get(u.colorIdx).Format(name)
138145
}
139146

140147
// Colorize the PM string
@@ -226,7 +233,8 @@ func init() {
226233
highlight: style(Bold + "\033[48;5;22m\033[38;5;46m"), // Green on dark green
227234
},
228235
{
229-
id: "mono",
236+
id: "mono",
237+
useID: true,
230238
},
231239
}
232240

0 commit comments

Comments
 (0)