diff --git a/src/internalHelpers/_hslToRgb.js b/src/internalHelpers/_hslToRgb.js index 0a07ffa5..b2732b7e 100644 --- a/src/internalHelpers/_hslToRgb.js +++ b/src/internalHelpers/_hslToRgb.js @@ -22,9 +22,9 @@ function hslToRgb( } // formular from https://en.wikipedia.org/wiki/HSL_and_HSV - const huePrime = hue % 360 / 60 + const huePrime = (((hue % 360) + 360) % 360) / 60 // Corrected for potential negative hue const chroma = (1 - Math.abs(2 * lightness - 1)) * saturation - const secondComponent = chroma * (1 - Math.abs(huePrime % 2 - 1)) + const secondComponent = chroma * (1 - Math.abs((huePrime % 2) - 1)) let red = 0 let green = 0