mirror of
https://github.com/shazow/ssh-chat.git
synced 2025-04-15 00:20:37 +03:00
chat/message/theme: Fixing zero division error for one color themes (#195)
This commit is contained in:
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)]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user