|
1 | 1 | /*!
|
2 |
| - * Less - Leaner CSS v2.7.1 |
| 2 | + * Less - Leaner CSS v2.7.2 |
3 | 3 | * http://lesscss.org
|
4 | 4 | *
|
5 |
| - * Copyright (c) 2009-2016, Alexis Sellier <[email protected]> |
| 5 | + * Copyright (c) 2009-2017, Alexis Sellier <[email protected]> |
6 | 6 | * Licensed under the Apache-2.0 License.
|
7 | 7 | *
|
8 | 8 | */
|
@@ -1718,41 +1718,33 @@ colorFunctions = {
|
1718 | 1718 | greyscale: function (color) {
|
1719 | 1719 | return colorFunctions.desaturate(color, new Dimension(100));
|
1720 | 1720 | },
|
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) { |
1726 | 1722 | // filter: contrast(3.2);
|
1727 | 1723 | // should be kept as is, so check for color
|
1728 | 1724 | if (!color.rgb) {
|
1729 | 1725 | return null;
|
1730 | 1726 | }
|
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); |
1733 | 1729 | }
|
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); |
1736 | 1732 | }
|
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; |
1746 | 1738 | }
|
1747 |
| - if (luma > luma2) { |
1748 |
| - contrast2 = (luma + 0.05) / (luma2 + 0.05); |
| 1739 | + if (typeof threshold === 'undefined') { |
| 1740 | + threshold = 0.43; |
1749 | 1741 | } else {
|
1750 |
| - contrast2 = (luma2 + 0.05) / (luma + 0.05); |
| 1742 | + threshold = number(threshold); |
1751 | 1743 | }
|
1752 |
| - if (contrast1 > contrast2) { |
1753 |
| - return color1; |
| 1744 | + if (color.luma() < threshold) { |
| 1745 | + return light; |
1754 | 1746 | } else {
|
1755 |
| - return color2; |
| 1747 | + return dark; |
1756 | 1748 | }
|
1757 | 1749 | },
|
1758 | 1750 | argb: function (color) {
|
@@ -2485,7 +2477,7 @@ module.exports = function(environment, fileManagers) {
|
2485 | 2477 | var SourceMapOutput, SourceMapBuilder, ParseTree, ImportManager, Environment;
|
2486 | 2478 |
|
2487 | 2479 | var less = {
|
2488 |
| - version: [2, 7, 1], |
| 2480 | + version: [2, 7, 2], |
2489 | 2481 | data: require('./data'),
|
2490 | 2482 | tree: require('./tree'),
|
2491 | 2483 | Environment: (Environment = require("./environment/environment")),
|
@@ -5872,6 +5864,7 @@ var Node = require("./node"),
|
5872 | 5864 | var Comment = function (value, isLineComment, index, currentFileInfo) {
|
5873 | 5865 | this.value = value;
|
5874 | 5866 | this.isLineComment = isLineComment;
|
| 5867 | + this.index = index; |
5875 | 5868 | this.currentFileInfo = currentFileInfo;
|
5876 | 5869 | this.allowRoot = true;
|
5877 | 5870 | };
|
|
0 commit comments