From d862e2bb62cf4e8b4aca87522381074f968c41f8 Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Tue, 28 May 2019 12:20:38 +0200 Subject: [PATCH] make go happy --- main.go | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/main.go b/main.go index 890177d..6a76f77 100644 --- a/main.go +++ b/main.go @@ -103,19 +103,25 @@ func (c *RGB) to_hsv() *HSV { } func (c *HSV) to_rgb() *RGB { - h := int((c.h / 60)) - f := c.h / 60 - h + h := int((c.h / 60)) + 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) { + q := c.v * (1 - c.s*f) + t := c.v * (1 - c.s*(1-f)) + 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) }