-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c93b7f6
commit ceb5405
Showing
3 changed files
with
30 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
* | ||
*/ | ||
|
@@ -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) { | ||
|
@@ -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; | ||
}; | ||
|
Oops, something went wrong.