Skip to content

Commit 39603ee

Browse files
committed
don't floor in fixColor, better error msg for mix
1 parent eb89325 commit 39603ee

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

lessc.inc.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1615,7 +1615,7 @@ function lib_percentage($number) {
16151615
// mix(@color1, @color2, @weight);
16161616
// http://sass-lang.com/docs/yardoc/Sass/Script/Functions.html#mix-instance_method
16171617
function lib_mix($args) {
1618-
if ($args[0] != "list")
1618+
if ($args[0] != "list" || count($args[2]) < 3)
16191619
$this->throwError("mix expects (color1, color2, weight)");
16201620

16211621
list($first, $second, $weight) = $args[2];
@@ -1940,7 +1940,6 @@ function fixColor($c) {
19401940
foreach (range(1, 3) as $i) {
19411941
if ($c[$i] < 0) $c[$i] = 0;
19421942
if ($c[$i] > 255) $c[$i] = 255;
1943-
$c[$i] = floor($c[$i]);
19441943
}
19451944

19461945
return $c;

tests/inputs/colors.less

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,10 @@ pre {
113113
@errorBackground: #f2dede;
114114
spin: spin(@errorBackground, -10);
115115
}
116+
117+
dd {
118+
@white: #fff;
119+
background-color: mix(@white, darken(@white, 10%), 60%);
120+
}
121+
122+

tests/outputs/colors.css

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ fade {
5353
f:rgba(255,255,255,0.2);
5454
f:rgba(34,23,64,0.5);
5555
}
56-
.mix { color:#7f7f7f; }
56+
.mix { color:#808080; }
5757
.percent { per:50%; }
5858
.colorz {
5959
color:#ebebeb;
@@ -65,4 +65,5 @@ body {
6565
chained:#fbeed5;
6666
direct:#fbefd5;
6767
}
68-
pre { spin:#f2dee1; }
68+
pre { spin:#f2dee1; }
69+
dd { background-color:#f5f5f5; }

0 commit comments

Comments
 (0)