function lessc::color in Less CSS Preprocessor 6.3
Same name and namespace in other branches
- 6 lessc.inc.php \lessc::color()
1 call to lessc::color()
- lessc::value in lessphp/
lessc.inc.php
File
- lessphp/
lessc.inc.php, line 510
Class
Code
function color(&$out) {
$color = array(
'color',
);
if ($this
->match('(#([0-9a-f]{6})|#([0-9a-f]{3}))', $m)) {
if (isset($m[3])) {
$num = $m[3];
$width = 16;
}
else {
$num = $m[2];
$width = 256;
}
$num = hexdec($num);
foreach (array(
3,
2,
1,
) as $i) {
$t = $num % $width;
$num /= $width;
$color[$i] = $t * (256 / $width) + $t * floor(16 / $width);
}
$out = $color;
return true;
}
return false;
}