hueToRGB converts a hue offset t into a single RGB component.
(p, q, t float64)
| 127 | |
| 128 | // hueToRGB converts a hue offset t into a single RGB component. |
| 129 | func hueToRGB(p, q, t float64) float64 { |
| 130 | if t < 0 { |
| 131 | t += 1 |
| 132 | } |
| 133 | if t > 1 { |
| 134 | t -= 1 |
| 135 | } |
| 136 | switch { |
| 137 | case t < 1.0/6.0: |
| 138 | return p + (q-p)*6*t |
| 139 | case t < 1.0/2.0: |
| 140 | return q |
| 141 | case t < 2.0/3.0: |
| 142 | return p + (q-p)*(2.0/3.0-t)*6 |
| 143 | default: |
| 144 | return p |
| 145 | } |
| 146 | } |
no outgoing calls