Skip to content

Commit ceb5405

Browse files
committed
v2.7.2
1 parent c93b7f6 commit ceb5405

File tree

3 files changed

+30
-37
lines changed

3 files changed

+30
-37
lines changed

dist/less.js

+20-27
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*!
2-
* Less - Leaner CSS v2.7.1
2+
* Less - Leaner CSS v2.7.2
33
* http://lesscss.org
44
*
5-
* Copyright (c) 2009-2016, Alexis Sellier <[email protected]>
5+
* Copyright (c) 2009-2017, Alexis Sellier <[email protected]>
66
* Licensed under the Apache-2.0 License.
77
*
88
*/
@@ -1718,41 +1718,33 @@ colorFunctions = {
17181718
greyscale: function (color) {
17191719
return colorFunctions.desaturate(color, new Dimension(100));
17201720
},
1721-
contrast: function (color, color1, color2, threshold) {
1722-
// Return which of `color1` and `color2` has the greatest contrast with `color`
1723-
// according to the standard WCAG contrast ratio calculation.
1724-
// http://www.w3.org/TR/WCAG20/#contrast-ratiodef
1725-
// The threshold param is no longer used, in line with SASS.
1721+
contrast: function (color, dark, light, threshold) {
17261722
// filter: contrast(3.2);
17271723
// should be kept as is, so check for color
17281724
if (!color.rgb) {
17291725
return null;
17301726
}
1731-
if (typeof color1 === 'undefined') {
1732-
color1 = colorFunctions.rgba(0, 0, 0, 1.0);
1727+
if (typeof light === 'undefined') {
1728+
light = colorFunctions.rgba(255, 255, 255, 1.0);
17331729
}
1734-
if (typeof color2 === 'undefined') {
1735-
color2 = colorFunctions.rgba(255, 255, 255, 1.0);
1730+
if (typeof dark === 'undefined') {
1731+
dark = colorFunctions.rgba(0, 0, 0, 1.0);
17361732
}
1737-
var contrast1, contrast2;
1738-
var luma = color.luma();
1739-
var luma1 = color1.luma();
1740-
var luma2 = color2.luma();
1741-
// Calculate contrast ratios for each color
1742-
if (luma > luma1) {
1743-
contrast1 = (luma + 0.05) / (luma1 + 0.05);
1744-
} else {
1745-
contrast1 = (luma1 + 0.05) / (luma + 0.05);
1733+
//Figure out which is actually light and dark!
1734+
if (dark.luma() > light.luma()) {
1735+
var t = light;
1736+
light = dark;
1737+
dark = t;
17461738
}
1747-
if (luma > luma2) {
1748-
contrast2 = (luma + 0.05) / (luma2 + 0.05);
1739+
if (typeof threshold === 'undefined') {
1740+
threshold = 0.43;
17491741
} else {
1750-
contrast2 = (luma2 + 0.05) / (luma + 0.05);
1742+
threshold = number(threshold);
17511743
}
1752-
if (contrast1 > contrast2) {
1753-
return color1;
1744+
if (color.luma() < threshold) {
1745+
return light;
17541746
} else {
1755-
return color2;
1747+
return dark;
17561748
}
17571749
},
17581750
argb: function (color) {
@@ -2485,7 +2477,7 @@ module.exports = function(environment, fileManagers) {
24852477
var SourceMapOutput, SourceMapBuilder, ParseTree, ImportManager, Environment;
24862478

24872479
var less = {
2488-
version: [2, 7, 1],
2480+
version: [2, 7, 2],
24892481
data: require('./data'),
24902482
tree: require('./tree'),
24912483
Environment: (Environment = require("./environment/environment")),
@@ -5872,6 +5864,7 @@ var Node = require("./node"),
58725864
var Comment = function (value, isLineComment, index, currentFileInfo) {
58735865
this.value = value;
58745866
this.isLineComment = isLineComment;
5867+
this.index = index;
58755868
this.currentFileInfo = currentFileInfo;
58765869
this.allowRoot = true;
58775870
};

0 commit comments

Comments
 (0)