diff --git a/lib/less/functions.js b/lib/less/functions.js index e471e78bf..06361aa35 100644 --- a/lib/less/functions.js +++ b/lib/less/functions.js @@ -187,7 +187,7 @@ tree.functions = { if (typeof threshold === 'undefined') { threshold = 0.43; } else { - threshold = threshold.value; + threshold = number(threshold); } if (((0.2126 * (color.rgb[0]/255) + 0.7152 * (color.rgb[1]/255) + 0.0722 * (color.rgb[2]/255)) * color.alpha) < threshold) { return light; diff --git a/test/css/functions.css b/test/css/functions.css index 67db3cb6f..3268d7801 100644 --- a/test/css/functions.css +++ b/test/css/functions.css @@ -38,6 +38,10 @@ contrast-dark-thresh: #eeeeee; contrast-high-thresh: #eeeeee; contrast-low-thresh: #111111; + contrast-light-thresh-per: #111111; + contrast-dark-thresh-per: #eeeeee; + contrast-high-thresh-per: #eeeeee; + contrast-low-thresh-per: #111111; format: "rgb(32, 128, 64)"; format-string: "hello world"; format-multiple: "hello earth 2"; diff --git a/test/less/functions.less b/test/less/functions.less index 3b7cfd53a..9e509e9ef 100644 --- a/test/less/functions.less +++ b/test/less/functions.less @@ -42,6 +42,10 @@ contrast-dark-thresh: contrast(#000, #111111, #eeeeee, 0.5); contrast-high-thresh: contrast(#555, #111111, #eeeeee, 0.6); contrast-low-thresh: contrast(#555, #111111, #eeeeee, 0.1); + contrast-light-thresh-per: contrast(#fff, #111111, #eeeeee, 50%); + contrast-dark-thresh-per: contrast(#000, #111111, #eeeeee, 50%); + contrast-high-thresh-per: contrast(#555, #111111, #eeeeee, 60%); + contrast-low-thresh-per: contrast(#555, #111111, #eeeeee, 10%); format: %("rgb(%d, %d, %d)", @r, 128, 64); format-string: %("hello %s", "world"); format-multiple: %("hello %s %d", "earth", 2);