From 7cd11d79d7dbd84a02201e0eb260da9719836dbc Mon Sep 17 00:00:00 2001 From: maxnyby Date: Sun, 16 Jun 2013 22:01:13 +0300 Subject: [PATCH] Updated contrast to make arguments 2 and 3 optional. --- lessc.inc.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lessc.inc.php b/lessc.inc.php index 5c81ad2a..48c9bc8f 100644 --- a/lessc.inc.php +++ b/lessc.inc.php @@ -1056,12 +1056,28 @@ protected function lib_mix($args) { } protected function lib_contrast($args) { - if ($args[0] != 'list' || count($args[2]) < 3) { + if($args[0] == 'color') { + $args = array( + 'list', + ',', + array( + $args, + array('color',0,0,0), + array('color',255,255,255) + ) + ); + } + + if ($args[0] != 'list' || count($args[2]) < 1) { return array(array('color', 0, 0, 0), 0); } list($inputColor, $darkColor, $lightColor) = $args[2]; + $darkColor = $darkColor ? $darkColor : array('color', 0, 0, 0); + $lightColor = $lightColor ? $lightColor : array('color', 255, 255, 255); + + $inputColor = $this->assertColor($inputColor); $darkColor = $this->assertColor($darkColor); $lightColor = $this->assertColor($lightColor);