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

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

View File

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