Skip to content

Commit

Permalink
"transparent" is a shorthand for rgba(0,0,0,0)
Browse files Browse the repository at this point in the history
  • Loading branch information
nyordanov committed Oct 29, 2012
1 parent f8a84b1 commit a764d0b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
9 changes: 7 additions & 2 deletions lessc.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -1322,8 +1322,12 @@ protected function coerceColor($value) {
case 'keyword':
$name = $value[1];
if (isset(self::$cssColors[$name])) {
list($r, $g, $b) = explode(',', self::$cssColors[$name]);
return array('color', $r, $g, $b);
$rgba = explode(',', self::$cssColors[$name]);

if(isset($rgba[3]))
return array('color', $rgba[0], $rgba[1], $rgba[2], $rgba[3]);

return array('color', $rgba[0], $rgba[1], $rgba[2]);
}
return null;
}
Expand Down Expand Up @@ -1996,6 +2000,7 @@ public static function cexecute($in, $force = false, $less = null) {
'teal' => '0,128,128',
'thistle' => '216,191,216',
'tomato' => '255,99,71',
'transparent' => '0,0,0,0',
'turquoise' => '64,224,208',
'violet' => '238,130,238',
'wheat' => '245,222,179',
Expand Down
7 changes: 6 additions & 1 deletion tests/inputs/colors.less
Original file line number Diff line number Diff line change
Expand Up @@ -144,5 +144,10 @@ dd {
c: 132- red;
}


.transparent {
r: red(transparent);
g: green(transparent);
b: blue(transparent);
a: alpha(transparent);
}

6 changes: 6 additions & 0 deletions tests/outputs/colors.css
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,9 @@ dd {
c: 132 - #ff0000;
c: 132- #ff0000;
}
.transparent {
r: 0;
g: 0;
b: 0;
a: 0;
}

0 comments on commit a764d0b

Please sign in to comment.