diff --git a/lib/Less/Functions.php b/lib/Less/Functions.php index 1254ee5f..0fdf11c7 100644 --- a/lib/Less/Functions.php +++ b/lib/Less/Functions.php @@ -81,7 +81,10 @@ public function rgba( $r = null, $g = null, $b = null, $a = null ) { return new Less_Tree_Color( $rgb, $a ); } - public function hsl( $h, $s, $l ) { + public function hsl_less($h, $s, $l ) { + if ( $h === null || $s === null || $l === null ) { + throw new Less_Exception_Compiler( "hsl_less expects three parameters" ); + } return $this->hsla( $h, $s, $l, 1.0 ); } diff --git a/lib/Less/Parser.php b/lib/Less/Parser.php index 46644233..865266d5 100644 --- a/lib/Less/Parser.php +++ b/lib/Less/Parser.php @@ -1269,7 +1269,7 @@ private function parseEntitiesVariableCurly() { * * #4F3C2F * - * `rgb` and `hsl` colors are parsed through the `entities.call` parser. + * `rgb` and `hsl_less` colors are parsed through the `entities.call` parser. * * @return Less_Tree_Color|null */ diff --git a/test/Fixtures/bug-reports/less/210.less b/test/Fixtures/bug-reports/less/210.less index f512d347..10562031 100644 --- a/test/Fixtures/bug-reports/less/210.less +++ b/test/Fixtures/bug-reports/less/210.less @@ -44,7 +44,7 @@ body { color: argb(rgba(@r,@g,@b,@a)); } .hsl { - color: hsl(@h,@s,@l); + color: hsl_less(@h,@s,@l); } .hsla { color: hsla(@h,@s,@l,@a); diff --git a/test/Fixtures/lessjs (1.5)/less/colors.less b/test/Fixtures/lessjs (1.5)/less/colors.less index 656ca636..a76b81c3 100644 --- a/test/Fixtures/lessjs (1.5)/less/colors.less +++ b/test/Fixtures/lessjs (1.5)/less/colors.less @@ -48,11 +48,11 @@ } #808080 { - color: hsl(50, 0%, 50%); + color: hsl_less(50, 0%, 50%); } #00ff00 { - color: hsl(120, 100%, 50%); + color: hsl_less(120, 100%, 50%); } .lightenblue { @@ -87,6 +87,6 @@ opacity: alpha(rgba(50, 120, 95, 0.2)); } #hsl { - opacity: alpha(hsl(120, 100%, 50%)); + opacity: alpha(hsl_less(120, 100%, 50%)); } } diff --git a/test/Fixtures/lessjs (1.5)/less/functions.less b/test/Fixtures/lessjs (1.5)/less/functions.less index b50a0da5..6b6452b5 100644 --- a/test/Fixtures/lessjs (1.5)/less/functions.less +++ b/test/Fixtures/lessjs (1.5)/less/functions.less @@ -17,9 +17,9 @@ saturate: saturate(#29332f, 20%); desaturate: desaturate(#203c31, 20%); greyscale: greyscale(#203c31); - hsl-clamp: hsl(380, 150%, 150%); - spin-p: spin(hsl(340, 50%, 50%), 40); - spin-n: spin(hsl(30, 50%, 50%), -40); + hsl-clamp: hsl_less(380, 150%, 150%); + spin-p: spin(hsl_less(340, 50%, 50%), 40); + spin-n: spin(hsl_less(30, 50%, 50%), -40); luma-white: luma(#fff); luma-black: luma(#000); luma-black-alpha: luma(rgba(0,0,0,0.5)); @@ -54,13 +54,13 @@ format-multiple: %("hello %s %d", "earth", 2); format-url-encode: %('red is %A', #ff0000); eformat: e(%("rgb(%d, %d, %d)", @r, 128, 64)); - + unitless: unit(12px); unit: unit((13px + 1px), em); - hue: hue(hsl(98, 12%, 95%)); - saturation: saturation(hsl(98, 12%, 95%)); - lightness: lightness(hsl(98, 12%, 95%)); + hue: hue(hsl_less(98, 12%, 95%)); + saturation: saturation(hsl_less(98, 12%, 95%)); + lightness: lightness(hsl_less(98, 12%, 95%)); hsvhue: hsvhue(hsv(98, 12%, 95%)); hsvsaturation: hsvsaturation(hsv(98, 12%, 95%)); hsvvalue: hsvvalue(hsv(98, 12%, 95%)); @@ -103,7 +103,7 @@ fade-out: fadeOut(red, 5%); // support fadeOut and fadeout fade-in: fadein(fadeout(red, 10%), 5%); - + hsv: hsv(5, 50%, 30%); hsva: hsva(3, 50%, 30%, 0.2); diff --git a/test/Fixtures/lessjs (1.5)/less/operations.less b/test/Fixtures/lessjs (1.5)/less/operations.less index 3e483c8b..973b10f1 100644 --- a/test/Fixtures/lessjs (1.5)/less/operations.less +++ b/test/Fixtures/lessjs (1.5)/less/operations.less @@ -21,8 +21,8 @@ .with-functions { color: (rgb(200, 200, 200) / 2); - color: (2 * hsl(0, 50%, 50%)); - color: (rgb(10, 10, 10) + hsl(0, 50%, 50%)); + color: (2 * hsl_less(0, 50%, 50%)); + color: (rgb(10, 10, 10) + hsl_less(0, 50%, 50%)); } @z: -2; diff --git a/test/Fixtures/lessjs (1.6)/less/colors.less b/test/Fixtures/lessjs (1.6)/less/colors.less index 7abda4e5..d4a84c1a 100644 --- a/test/Fixtures/lessjs (1.6)/less/colors.less +++ b/test/Fixtures/lessjs (1.6)/less/colors.less @@ -37,7 +37,7 @@ .b { color: (#eee + #fff); } // #ffffff .c { color: (#aaa * 3); } // #ffffff .d { color: (#00ee00 + #009900); } // #00ff00 - .e { color: rgba(-99.9, 31.4159, 321, 0.42); } + .e { color: rgba(-99.9, 31.4159, 321, 0.42); } } #grey { @@ -49,11 +49,11 @@ } #808080 { - color: hsl(50, 0%, 50%); + color: hsl_less(50, 0%, 50%); } #00ff00 { - color: hsl(120, 100%, 50%); + color: hsl_less(120, 100%, 50%); } .lightenblue { @@ -88,7 +88,7 @@ opacity: alpha(rgba(50, 120, 95, 0.2)); } #hsl { - opacity: alpha(hsl(120, 100%, 50%)); + opacity: alpha(hsl_less(120, 100%, 50%)); } } diff --git a/test/Fixtures/lessjs (1.6)/less/functions.less b/test/Fixtures/lessjs (1.6)/less/functions.less index 170a915b..889756c0 100644 --- a/test/Fixtures/lessjs (1.6)/less/functions.less +++ b/test/Fixtures/lessjs (1.6)/less/functions.less @@ -17,9 +17,9 @@ saturate: saturate(#29332f, 20%); desaturate: desaturate(#203c31, 20%); greyscale: greyscale(#203c31); - hsl-clamp: hsl(380, 150%, 150%); - spin-p: spin(hsl(340, 50%, 50%), 40); - spin-n: spin(hsl(30, 50%, 50%), -40); + hsl-clamp: hsl_less(380, 150%, 150%); + spin-p: spin(hsl_less(340, 50%, 50%), 40); + spin-n: spin(hsl_less(30, 50%, 50%), -40); luma-white: luma(#fff); luma-black: luma(#000); luma-black-alpha: luma(rgba(0,0,0,0.5)); @@ -54,13 +54,13 @@ format-multiple: %("hello %s %d", "earth", 2); format-url-encode: %('red is %A', #ff0000); eformat: e(%("rgb(%d, %d, %d)", @r, 128, 64)); - + unitless: unit(12px); unit: unit((13px + 1px), em); - hue: hue(hsl(98, 12%, 95%)); - saturation: saturation(hsl(98, 12%, 95%)); - lightness: lightness(hsl(98, 12%, 95%)); + hue: hue(hsl_less(98, 12%, 95%)); + saturation: saturation(hsl_less(98, 12%, 95%)); + lightness: lightness(hsl_less(98, 12%, 95%)); hsvhue: hsvhue(hsv(98, 12%, 95%)); hsvsaturation: hsvsaturation(hsv(98, 12%, 95%)); hsvvalue: hsvvalue(hsv(98, 12%, 95%)); @@ -105,7 +105,7 @@ fade-out: fadeOut(red, 5%); // support fadeOut and fadeout fade-in: fadein(fadeout(red, 10%), 5%); - + hsv: hsv(5, 50%, 30%); hsva: hsva(3, 50%, 30%, 0.2); diff --git a/test/Fixtures/lessjs (1.6)/less/operations.less b/test/Fixtures/lessjs (1.6)/less/operations.less index 3e483c8b..973b10f1 100644 --- a/test/Fixtures/lessjs (1.6)/less/operations.less +++ b/test/Fixtures/lessjs (1.6)/less/operations.less @@ -21,8 +21,8 @@ .with-functions { color: (rgb(200, 200, 200) / 2); - color: (2 * hsl(0, 50%, 50%)); - color: (rgb(10, 10, 10) + hsl(0, 50%, 50%)); + color: (2 * hsl_less(0, 50%, 50%)); + color: (rgb(10, 10, 10) + hsl_less(0, 50%, 50%)); } @z: -2; diff --git a/test/Fixtures/lessjs/less/colors.less b/test/Fixtures/lessjs/less/colors.less index 7abda4e5..d4a84c1a 100644 --- a/test/Fixtures/lessjs/less/colors.less +++ b/test/Fixtures/lessjs/less/colors.less @@ -37,7 +37,7 @@ .b { color: (#eee + #fff); } // #ffffff .c { color: (#aaa * 3); } // #ffffff .d { color: (#00ee00 + #009900); } // #00ff00 - .e { color: rgba(-99.9, 31.4159, 321, 0.42); } + .e { color: rgba(-99.9, 31.4159, 321, 0.42); } } #grey { @@ -49,11 +49,11 @@ } #808080 { - color: hsl(50, 0%, 50%); + color: hsl_less(50, 0%, 50%); } #00ff00 { - color: hsl(120, 100%, 50%); + color: hsl_less(120, 100%, 50%); } .lightenblue { @@ -88,7 +88,7 @@ opacity: alpha(rgba(50, 120, 95, 0.2)); } #hsl { - opacity: alpha(hsl(120, 100%, 50%)); + opacity: alpha(hsl_less(120, 100%, 50%)); } } diff --git a/test/Fixtures/lessjs/less/functions.less b/test/Fixtures/lessjs/less/functions.less index 4b4720d9..0a756f37 100644 --- a/test/Fixtures/lessjs/less/functions.less +++ b/test/Fixtures/lessjs/less/functions.less @@ -17,9 +17,9 @@ saturate: saturate(#29332f, 20%); desaturate: desaturate(#203c31, 20%); greyscale: greyscale(#203c31); - hsl-clamp: hsl(380, 150%, 150%); - spin-p: spin(hsl(340, 50%, 50%), 40); - spin-n: spin(hsl(30, 50%, 50%), -40); + hsl-clamp: hsl_less(380, 150%, 150%); + spin-p: spin(hsl_less(340, 50%, 50%), 40); + spin-n: spin(hsl_less(30, 50%, 50%), -40); luma-white: luma(#fff); luma-black: luma(#000); luma-black-alpha: luma(rgba(0,0,0,0.5)); @@ -67,17 +67,17 @@ format-single-quoted: %('hello %s', "single world"); format-escaped-string: %(~"hello %s", "escaped world"); eformat: e(%("rgb(%d, %d, %d)", @r, 128, 64)); - + unitless: unit(12px); unit: unit((13px + 1px), em); unitpercentage: unit(100, %); - + get-unit: get-unit(10px); get-unit-empty: get-unit(10); - hue: hue(hsl(98, 12%, 95%)); - saturation: saturation(hsl(98, 12%, 95%)); - lightness: lightness(hsl(98, 12%, 95%)); + hue: hue(hsl_less(98, 12%, 95%)); + saturation: saturation(hsl_less(98, 12%, 95%)); + lightness: lightness(hsl_less(98, 12%, 95%)); hsvhue: hsvhue(hsv(98, 12%, 95%)); hsvsaturation: hsvsaturation(hsv(98, 12%, 95%)); hsvvalue: hsvvalue(hsv(98, 12%, 95%)); @@ -123,7 +123,7 @@ fade-out: fadeOut(red, 5%); // support fadeOut and fadeout fade-in: fadein(fadeout(red, 10%), 5%); - + hsv: hsv(5, 50%, 30%); hsva: hsva(3, 50%, 30%, 0.2); diff --git a/test/Fixtures/lessjs/less/operations.less b/test/Fixtures/lessjs/less/operations.less index 3e483c8b..973b10f1 100644 --- a/test/Fixtures/lessjs/less/operations.less +++ b/test/Fixtures/lessjs/less/operations.less @@ -21,8 +21,8 @@ .with-functions { color: (rgb(200, 200, 200) / 2); - color: (2 * hsl(0, 50%, 50%)); - color: (rgb(10, 10, 10) + hsl(0, 50%, 50%)); + color: (2 * hsl_less(0, 50%, 50%)); + color: (rgb(10, 10, 10) + hsl_less(0, 50%, 50%)); } @z: -2; diff --git a/test/assets/less-1.6.3.js b/test/assets/less-1.6.3.js index 1e3082bc..3a10d519 100644 --- a/test/assets/less-1.6.3.js +++ b/test/assets/less-1.6.3.js @@ -978,7 +978,7 @@ less.Parser = function Parser(env) { // // #4F3C2F // - // `rgb` and `hsl` colors are parsed through the `entities.call` parser. + // `rgb` and `hsl_less` colors are parsed through the `entities.call` parser. // color: function () { var rgb; @@ -7637,4 +7637,4 @@ if (typeof define === "function" && define.amd) { define(function () { return less; } ); } -})(window); \ No newline at end of file +})(window); diff --git a/test/assets/less-1.7.0.js b/test/assets/less-1.7.0.js index a9c76111..5650dfc0 100644 --- a/test/assets/less-1.7.0.js +++ b/test/assets/less-1.7.0.js @@ -981,7 +981,7 @@ less.Parser = function Parser(env) { // // #4F3C2F // - // `rgb` and `hsl` colors are parsed through the `entities.call` parser. + // `rgb` and `hsl_less` colors are parsed through the `entities.call` parser. // color: function () { var rgb; @@ -7933,4 +7933,4 @@ if (typeof define === "function" && define.amd) { define(function () { return less; } ); } -})(window); \ No newline at end of file +})(window); diff --git a/test/assets/less-1.7.1.js b/test/assets/less-1.7.1.js index c62264fc..d951340a 100644 --- a/test/assets/less-1.7.1.js +++ b/test/assets/less-1.7.1.js @@ -981,7 +981,7 @@ less.Parser = function Parser(env) { // // #4F3C2F // - // `rgb` and `hsl` colors are parsed through the `entities.call` parser. + // `rgb` and `hsl_less` colors are parsed through the `entities.call` parser. // color: function () { var rgb; @@ -7933,4 +7933,4 @@ if (typeof define === "function" && define.amd) { define(function () { return less; } ); } -})(window); \ No newline at end of file +})(window); diff --git a/test/assets/less-1.7.5.js b/test/assets/less-1.7.5.js index 9530af82..3a9fe38a 100644 --- a/test/assets/less-1.7.5.js +++ b/test/assets/less-1.7.5.js @@ -981,7 +981,7 @@ less.Parser = function Parser(env) { // // #4F3C2F // - // `rgb` and `hsl` colors are parsed through the `entities.call` parser. + // `rgb` and `hsl_less` colors are parsed through the `entities.call` parser. // color: function () { var rgb; diff --git a/test/assets/less-2.5.3.js b/test/assets/less-2.5.3.js index 83a6e495..3e3bc07f 100644 --- a/test/assets/less-2.5.3.js +++ b/test/assets/less-2.5.3.js @@ -7,7 +7,7 @@ * */ - /** * @license + /** * @license */ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.less = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o