From c1a8e56efc3d0bf5d4fdb2f9bc44d9020f56b5a7 Mon Sep 17 00:00:00 2001 From: Erik Lumbela Date: Thu, 30 Nov 2023 21:56:23 +0100 Subject: [PATCH] fix issue with negative hues getColorInfo(hue) sometimes returned "Color not found" when hue was negative --- randomColor.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/randomColor.js b/randomColor.js index 111b00d..2f26a39 100644 --- a/randomColor.js +++ b/randomColor.js @@ -294,6 +294,9 @@ if (hue >= 334 && hue <= 360) { hue -= 360; } + if (hue < 0) { + hue *= -1; + } for (var colorName in colorDictionary) { var color = colorDictionary[colorName];