make go happy

This commit is contained in:
Andreas Shimokawa 2019-05-28 12:20:38 +02:00
parent a0d27e7e33
commit d862e2bb62

22
main.go
View File

@ -104,18 +104,24 @@ func (c *RGB) to_hsv() *HSV {
func (c *HSV) to_rgb() *RGB {
h := int((c.h / 60))
f := c.h / 60 - h
f := c.h/60 - float32(h)
p := c.v * (1 - c.s)
q := c.v * (1 - c.s*f)
t := c.v * (1 - c.s*(1-f))
switch (h) {
switch h {
case 6:
case 0: return f2rgb(c.v, t, p)
case 1: return f2rgb(q, c.v, p)
case 2: return f2rgb(p, c.v, t)
case 3: return f2rgb(p, q, c.v)
case 4: return f2rgb(t, p, c.v)
case 5: return f2rgb(c.v, p, q)
case 0:
return f2rgb(c.v, t, p)
case 1:
return f2rgb(q, c.v, p)
case 2:
return f2rgb(p, c.v, t)
case 3:
return f2rgb(p, q, c.v)
case 4:
return f2rgb(t, p, c.v)
case 5:
return f2rgb(c.v, p, q)
}
return f2rgb(0, 0, 0)
}