fix gradient color selection out of range for dynamic resize case
This commit is contained in:
parent
25f5a99de9
commit
db9e76bec3
|
@ -67,6 +67,9 @@ func GetPalette(theme Theme) Palette {
|
|||
}
|
||||
|
||||
func GetGradientColor(gradient []ui.Color, cur int, max int) ui.Color {
|
||||
if cur > max {
|
||||
cur = max
|
||||
}
|
||||
ratio := float64(len(gradient)) / float64(max)
|
||||
return gradient[int(ratio*float64(cur))]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue