mirror of
https://github.com/nikolaydubina/calendarheatmap.git
synced 2025-03-04 16:15:45 +02:00
empty colorscale returns some value
This commit is contained in:
parent
513db54b64
commit
594a8f6c77
@ -15,6 +15,9 @@ type BasicColorScale []color.RGBA
|
||||
|
||||
// GetColor returns color based on float value from 0 to 1
|
||||
func (c BasicColorScale) GetColor(val float64) color.RGBA {
|
||||
if len(c) == 0 {
|
||||
return color.RGBA{}
|
||||
}
|
||||
maxIdx := len(c) - 1
|
||||
idx := int(math.Round(float64(maxIdx) * val))
|
||||
return c[idx]
|
||||
|
Loading…
x
Reference in New Issue
Block a user