mirror of
https://github.com/shazow/ssh-chat.git
synced 2025-05-31 15:49:37 +03:00
chat/message: Use user.ID() names for mono bot theme
This commit is contained in:
parent
53ae43fb1b
commit
7461ca8e39
@ -122,6 +122,7 @@ type Theme struct {
|
|||||||
pm Style
|
pm Style
|
||||||
highlight Style
|
highlight Style
|
||||||
names *Palette
|
names *Palette
|
||||||
|
useID bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (theme Theme) ID() string {
|
func (theme Theme) ID() string {
|
||||||
@ -130,11 +131,17 @@ func (theme Theme) ID() string {
|
|||||||
|
|
||||||
// Colorize name string given some index
|
// Colorize name string given some index
|
||||||
func (theme Theme) ColorName(u *User) string {
|
func (theme Theme) ColorName(u *User) string {
|
||||||
|
var name string
|
||||||
|
if theme.useID {
|
||||||
|
name = u.ID()
|
||||||
|
} else {
|
||||||
|
name = u.Name()
|
||||||
|
}
|
||||||
if theme.names == nil {
|
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
|
// Colorize the PM string
|
||||||
@ -227,6 +234,7 @@ func init() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "mono",
|
id: "mono",
|
||||||
|
useID: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user