We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 89338a7 + 79e8d32 commit 20d8870Copy full SHA for 20d8870
functions.cpp
@@ -281,11 +281,18 @@ namespace Sass {
281
s /= 100.0;
282
l /= 100.0;
283
284
+ if (l < 0) l = 0;
285
+ if (s < 0) s = 0;
286
+ if (l > 1) l = 1;
287
+ if (s > 1) s = 1;
288
+ while (h < 0) h += 1;
289
+ while (h > 1) h -= 1;
290
+
291
// Algorithm from the CSS3 spec: http://www.w3.org/TR/css3-color/#hsl-color.
292
double m2;
293
if (l <= 0.5) m2 = l*(s+1.0);
294
else m2 = (l+s)-(l*s);
- double m1 = (l*2)-m2;
295
+ double m1 = (l*2.0)-m2;
296
// round the results -- consider moving this into the Color constructor
297
double r = (h_to_rgb(m1, m2, h+1.0/3.0) * 255.0);
298
double g = (h_to_rgb(m1, m2, h) * 255.0);
0 commit comments