mirror of
https://github.com/shazow/ssh-chat.git
synced 2025-04-13 07:37:17 +03:00
chat/message/theme: Apply PM colors, add new themes to /help, cleanup.
Fixes #191.
This commit is contained in:
parent
f870c5761d
commit
92d821387b
@ -180,7 +180,7 @@ func InitCommands(c *Commands) {
|
||||
c.Add(Command{
|
||||
Prefix: "/theme",
|
||||
PrefixHelp: "[mono|colors]",
|
||||
Help: "Set your color theme.",
|
||||
Help: "Set your color theme. (More themes: solarized, hacker)",
|
||||
Handler: func(room *Room, msg message.CommandMsg) error {
|
||||
user := msg.From()
|
||||
args := msg.Args()
|
||||
|
@ -176,7 +176,11 @@ func (m PrivateMsg) To() *User {
|
||||
}
|
||||
|
||||
func (m PrivateMsg) Render(t *Theme) string {
|
||||
return fmt.Sprintf("[PM from %s] %s", m.from.Name(), m.body)
|
||||
s := fmt.Sprintf("[PM from %s] %s", m.from.Name(), m.body)
|
||||
if t == nil {
|
||||
return s
|
||||
}
|
||||
return t.ColorPM(s)
|
||||
}
|
||||
|
||||
func (m PrivateMsg) String() string {
|
||||
|
@ -200,8 +200,8 @@ func hackerColors() *Palette {
|
||||
|
||||
func init() {
|
||||
palette := readableColors256()
|
||||
solar := solarizedColors()
|
||||
hacker := hackerColors()
|
||||
solarized := solarizedColors()
|
||||
hacker := hackerColors()
|
||||
|
||||
Themes = []Theme{
|
||||
{
|
||||
@ -213,27 +213,31 @@ func init() {
|
||||
},
|
||||
{
|
||||
id: "solarized",
|
||||
names: solar,
|
||||
sys: Color256(11),
|
||||
pm: Color256(15),
|
||||
highlight: style(Bold + "\033[48;5;202m\033[38;5;256m"), // orange highlight
|
||||
names: solarized,
|
||||
sys: Color256(11), // Yellow
|
||||
pm: Color256(15), // White
|
||||
highlight: style(Bold + "\033[48;5;202m\033[38;5;256m"), // Orange highlight
|
||||
},
|
||||
{
|
||||
id: "hacker",
|
||||
names: hacker,
|
||||
sys: Color256(22),
|
||||
pm: Color256(22),
|
||||
highlight: style(Bold + "\033[48;5;22m\033[38;5;256m"), // green bg black fg
|
||||
sys: Color256(22), // Green
|
||||
pm: Color256(28), // More green, slightly lighter
|
||||
highlight: style(Bold + "\033[48;5;22m\033[38;5;256m"), // Green on black
|
||||
},
|
||||
{
|
||||
id: "mono",
|
||||
},
|
||||
}
|
||||
|
||||
// Debug for printing colors:
|
||||
//for _, color := range palette.colors {
|
||||
// fmt.Print(color.Format(color.String() + " "))
|
||||
//}
|
||||
|
||||
DefaultTheme = &Themes[0]
|
||||
|
||||
// Debug for printing colors:
|
||||
//printPalette(palette)
|
||||
}
|
||||
|
||||
func printPalette(p *Palette) {
|
||||
for _, color := range p.colors {
|
||||
fmt.Print(color.Format(color.String() + " "))
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user