Skip to content

Commit

Permalink
chat/message: Use user.ID() names for mono bot theme
Browse files Browse the repository at this point in the history
  • Loading branch information
shazow committed Aug 3, 2020
1 parent 53ae43f commit 7461ca8
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions chat/message/theme.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ type Theme struct {
pm Style
highlight Style
names *Palette
useID bool
}

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

// Colorize name string given some index
func (theme Theme) ColorName(u *User) string {
var name string
if theme.useID {
name = u.ID()
} else {
name = u.Name()
}
if theme.names == nil {
return u.Name()
return name
}

return theme.names.Get(u.colorIdx).Format(u.Name())
return theme.names.Get(u.colorIdx).Format(name)
}

// Colorize the PM string
Expand Down Expand Up @@ -226,7 +233,8 @@ func init() {
highlight: style(Bold + "\033[48;5;22m\033[38;5;46m"), // Green on dark green
},
{
id: "mono",
id: "mono",
useID: true,
},
}

Expand Down

0 comments on commit 7461ca8

Please sign in to comment.