mirror of
https://github.com/less/less.js.git
synced 2026-01-23 06:07:56 -05:00
Fix contrast percentage handling, fixes #1144
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user