mirror of
https://github.com/shazow/ssh-chat.git
synced 2026-11-12 02:22:45 +03:00
chat/message/theme: Fixing zero division error for one color themes (#195)
This commit is contained in:
1 parent
91c62966fa
commit
ef2cec2758
1 file changed
+3
@@ -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)]
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user