From 7b5f46ca312dcd9295ada5e573853ae7bddb426d Mon Sep 17 00:00:00 2001 From: Marcel Greter Date: Fri, 24 Jun 2016 20:31:05 +0200 Subject: [PATCH] Fix error with hue color change function Spec https://github.com/sass/sass-spec/pull/875 Fixes https://github.com/sass/libsass/issues/2112 --- src/functions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/functions.cpp b/src/functions.cpp index 4ca3d77cb1..a203b6c77f 100644 --- a/src/functions.cpp +++ b/src/functions.cpp @@ -819,7 +819,7 @@ namespace Sass { } if (hsl) { HSL hsl_struct = rgb_to_hsl(color->r(), color->g(), color->b()); - if (h) hsl_struct.h = static_cast(((static_cast(h->value()) % 360) + 360) % 360) / 360.0; + if (h) hsl_struct.h = std::fmod(h->value(), 360.0); if (s) hsl_struct.s = ARGR("$saturation", Number, 0, 100)->value(); if (l) hsl_struct.l = ARGR("$lightness", Number, 0, 100)->value(); double alpha = a ? ARGR("$alpha", Number, 0, 1.0)->value() : color->a();