1
0
mirror of https://github.com/shazow/ssh-chat.git synced 2025-08-11 13:01:27 +03:00

chat/message/theme: Fixing zero division error for one color themes ()

This commit is contained in:
S Leibrock 2016-08-07 15:12:19 -04:00 committed by Andrey Petrov
parent 91c62966fa
commit ef2cec2758

@ -83,6 +83,9 @@ type Palette struct {
// Get a color by index, overflows are looped around. // Get a color by index, overflows are looped around.
func (p Palette) Get(i int) Style { func (p Palette) Get(i int) Style {
if p.size == 1 {
return p.colors[0]
}
return p.colors[i%(p.size-1)] return p.colors[i%(p.size-1)]
} }