(minStep float32, maxStep float32, current float32, colors ...Color)
| 655 | } |
| 656 | |
| 657 | func getColor(minStep float32, maxStep float32, current float32, colors ...Color) Color { |
| 658 | // split the range into equal parts |
| 659 | // and assign a color to each part |
| 660 | // the last color is assigned to the max value |
| 661 | // and the first color to the min value |
| 662 | // the rest of the colors are assigned to the |
| 663 | // middle values |
| 664 | step := (maxStep - minStep) / float32(len(colors)) |
| 665 | for i := range colors { |
| 666 | if current >= minStep+float32(i)*step && current < minStep+float32(i+1)*step { |
| 667 | return colors[i] |
| 668 | } |
| 669 | } |
| 670 | return colors[len(colors)-1] |
| 671 | } |
| 672 | |
| 673 | // Render prints the HeatmapPrinter to the terminal. |
| 674 | func (p HeatmapPrinter) Render() error { |
no outgoing calls
no test coverage detected
searching dependent graphs…