Skip to content

Commit

Permalink
v2.7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew-dean committed Jan 5, 2017
1 parent c93b7f6 commit ceb5405
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 37 deletions.
47 changes: 20 additions & 27 deletions dist/less.js
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
* Copyright (c) 2009-2017, Alexis Sellier <[email protected]>
* Licensed under the Apache-2.0 License.
*
*/
Expand Down Expand Up @@ -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);
} else {
contrast1 = (luma1 + 0.05) / (luma + 0.05);
//Figure out which is actually light and dark!
if (dark.luma() > light.luma()) {
var t = light;
light = dark;
dark = t;
}
if (luma > luma2) {
contrast2 = (luma + 0.05) / (luma2 + 0.05);
if (typeof threshold === 'undefined') {
threshold = 0.43;
} else {
contrast2 = (luma2 + 0.05) / (luma + 0.05);
threshold = number(threshold);
}
if (contrast1 > contrast2) {
return color1;
if (color.luma() < threshold) {
return light;
} else {
return color2;
return dark;
}
},
argb: function (color) {
Expand Down Expand Up @@ -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")),
Expand Down Expand Up @@ -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;
};
Expand Down
Loading

0 comments on commit ceb5405

Please sign in to comment.