This commit is contained in:
Matthew Dean
2017-01-04 17:57:58 -08:00
parent c93b7f6395
commit ceb54053e7
3 changed files with 31 additions and 38 deletions

49
dist/less.js vendored
View File

@@ -1,8 +1,8 @@
/*!
* Less - Leaner CSS v2.7.1
* Less - Leaner CSS v2.7.2
* http://lesscss.org
*
* Copyright (c) 2009-2016, Alexis Sellier <self@cloudhead.net>
* Copyright (c) 2009-2017, Alexis Sellier <self@cloudhead.net>
* Licensed under the Apache-2.0 License.
*
*/
@@ -1718,41 +1718,33 @@ colorFunctions = {
greyscale: function (color) {
return colorFunctions.desaturate(color, new Dimension(100));
},
contrast: function (color, color1, color2, threshold) {
// Return which of `color1` and `color2` has the greatest contrast with `color`
// according to the standard WCAG contrast ratio calculation.
// http://www.w3.org/TR/WCAG20/#contrast-ratiodef
// The threshold param is no longer used, in line with SASS.
contrast: function (color, dark, light, threshold) {
// filter: contrast(3.2);
// should be kept as is, so check for color
if (!color.rgb) {
return null;
}
if (typeof color1 === 'undefined') {
color1 = colorFunctions.rgba(0, 0, 0, 1.0);
if (typeof light === 'undefined') {
light = colorFunctions.rgba(255, 255, 255, 1.0);
}
if (typeof color2 === 'undefined') {
color2 = colorFunctions.rgba(255, 255, 255, 1.0);
if (typeof dark === 'undefined') {
dark = colorFunctions.rgba(0, 0, 0, 1.0);
}
var contrast1, contrast2;
var luma = color.luma();
var luma1 = color1.luma();
var luma2 = color2.luma();
// Calculate contrast ratios for each color
if (luma > luma1) {
contrast1 = (luma + 0.05) / (luma1 + 0.05);
//Figure out which is actually light and dark!
if (dark.luma() > light.luma()) {
var t = light;
light = dark;
dark = t;
}
if (typeof threshold === 'undefined') {
threshold = 0.43;
} else {
contrast1 = (luma1 + 0.05) / (luma + 0.05);
threshold = number(threshold);
}
if (luma > luma2) {
contrast2 = (luma + 0.05) / (luma2 + 0.05);
if (color.luma() < threshold) {
return light;
} else {
contrast2 = (luma2 + 0.05) / (luma + 0.05);
}
if (contrast1 > contrast2) {
return color1;
} else {
return color2;
return dark;
}
},
argb: function (color) {
@@ -2485,7 +2477,7 @@ module.exports = function(environment, fileManagers) {
var SourceMapOutput, SourceMapBuilder, ParseTree, ImportManager, Environment;
var less = {
version: [2, 7, 1],
version: [2, 7, 2],
data: require('./data'),
tree: require('./tree'),
Environment: (Environment = require("./environment/environment")),
@@ -5872,6 +5864,7 @@ var Node = require("./node"),
var Comment = function (value, isLineComment, index, currentFileInfo) {
this.value = value;
this.isLineComment = isLineComment;
this.index = index;
this.currentFileInfo = currentFileInfo;
this.allowRoot = true;
};

14
dist/less.min.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -38,7 +38,7 @@
saturate-filter: saturate(5%);
contrast-white: #000000;
contrast-black: #ffffff;
contrast-red: #000000;
contrast-red: #ffffff;
contrast-green: #000000;
contrast-blue: #ffffff;
contrast-yellow: #000000;
@@ -49,11 +49,11 @@
contrast-light-thresh: #111111;
contrast-dark-thresh: #eeeeee;
contrast-high-thresh: #eeeeee;
contrast-low-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: #eeeeee;
contrast-low-thresh-per: #111111;
replace: "Hello, World!";
replace-captured: "This is a new string.";
replace-with-flags: "2 + 2 = 4";