From acec0f622275009c11927ccda27f4d99bf621cca Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Thu, 15 Aug 2024 16:51:36 -0400 Subject: [PATCH] Fix HSV.RGBA sector overflow --- internal/color.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/color.go b/internal/color.go index 3c7ac2f..e8f0c4e 100644 --- a/internal/color.go +++ b/internal/color.go @@ -42,6 +42,8 @@ func (hsv HSV) RGBA () (r, g, b, a uint32) { h := clamp01(hsv.H) * 360 sector := int(h / 60) + // otherwise when given 1.0 for H, sector would overflow to 6 + if sector > 5 { sector = 5 } offset := (h / 60) - float64(sector) p := component(v * (1 - s))