less 2.7.1 → 2.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -266,41 +266,33 @@ colorFunctions = {
266
266
  greyscale: function (color) {
267
267
  return colorFunctions.desaturate(color, new Dimension(100));
268
268
  },
269
- contrast: function (color, color1, color2, threshold) {
270
- // Return which of `color1` and `color2` has the greatest contrast with `color`
271
- // according to the standard WCAG contrast ratio calculation.
272
- // http://www.w3.org/TR/WCAG20/#contrast-ratiodef
273
- // The threshold param is no longer used, in line with SASS.
269
+ contrast: function (color, dark, light, threshold) {
274
270
  // filter: contrast(3.2);
275
271
  // should be kept as is, so check for color
276
272
  if (!color.rgb) {
277
273
  return null;
278
274
  }
279
- if (typeof color1 === 'undefined') {
280
- color1 = colorFunctions.rgba(0, 0, 0, 1.0);
275
+ if (typeof light === 'undefined') {
276
+ light = colorFunctions.rgba(255, 255, 255, 1.0);
281
277
  }
282
- if (typeof color2 === 'undefined') {
283
- color2 = colorFunctions.rgba(255, 255, 255, 1.0);
278
+ if (typeof dark === 'undefined') {
279
+ dark = colorFunctions.rgba(0, 0, 0, 1.0);
284
280
  }
285
- var contrast1, contrast2;
286
- var luma = color.luma();
287
- var luma1 = color1.luma();
288
- var luma2 = color2.luma();
289
- // Calculate contrast ratios for each color
290
- if (luma > luma1) {
291
- contrast1 = (luma + 0.05) / (luma1 + 0.05);
292
- } else {
293
- contrast1 = (luma1 + 0.05) / (luma + 0.05);
281
+ //Figure out which is actually light and dark!
282
+ if (dark.luma() > light.luma()) {
283
+ var t = light;
284
+ light = dark;
285
+ dark = t;
294
286
  }
295
- if (luma > luma2) {
296
- contrast2 = (luma + 0.05) / (luma2 + 0.05);
287
+ if (typeof threshold === 'undefined') {
288
+ threshold = 0.43;
297
289
  } else {
298
- contrast2 = (luma2 + 0.05) / (luma + 0.05);
290
+ threshold = number(threshold);
299
291
  }
300
- if (contrast1 > contrast2) {
301
- return color1;
292
+ if (color.luma() < threshold) {
293
+ return light;
302
294
  } else {
303
- return color2;
295
+ return dark;
304
296
  }
305
297
  },
306
298
  argb: function (color) {
package/lib/less/index.js CHANGED
@@ -2,7 +2,7 @@ module.exports = function(environment, fileManagers) {
2
2
  var SourceMapOutput, SourceMapBuilder, ParseTree, ImportManager, Environment;
3
3
 
4
4
  var less = {
5
- version: [2, 7, 1],
5
+ version: [2, 7, 2],
6
6
  data: require('./data'),
7
7
  tree: require('./tree'),
8
8
  Environment: (Environment = require("./environment/environment")),
@@ -4,6 +4,7 @@ var Node = require("./node"),
4
4
  var Comment = function (value, isLineComment, index, currentFileInfo) {
5
5
  this.value = value;
6
6
  this.isLineComment = isLineComment;
7
+ this.index = index;
7
8
  this.currentFileInfo = currentFileInfo;
8
9
  this.allowRoot = true;
9
10
  };
@@ -15,8 +15,8 @@ var lessc_helper = {
15
15
  'red' : [31, 39],
16
16
  'grey' : [90, 39]
17
17
  };
18
- return '\033[' + styles[style][0] + 'm' + str +
19
- '\033[' + styles[style][1] + 'm';
18
+ return '\x1b[' + styles[style][0] + 'm' + str +
19
+ '\x1b[' + styles[style][1] + 'm';
20
20
  },
21
21
 
22
22
  //Print command line options
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "less",
3
- "version": "2.7.1",
3
+ "version": "2.7.2",
4
4
  "description": "Leaner CSS",
5
5
  "homepage": "http://lesscss.org",
6
6
  "author": {
@@ -46,11 +46,12 @@
46
46
  "mime": "^1.2.11",
47
47
  "mkdirp": "^0.5.0",
48
48
  "promise": "^7.1.1",
49
- "source-map": "^0.5.3"
49
+ "source-map": "^0.5.3",
50
+ "request": "^2.72.0"
50
51
  },
51
52
  "devDependencies": {
52
53
  "diff": "^2.2.2",
53
- "grunt": "^1.0.1",
54
+ "grunt": "~0.4.5",
54
55
  "grunt-browserify": "^5.0.0",
55
56
  "grunt-contrib-clean": "^1.0.0",
56
57
  "grunt-contrib-concat": "^1.0.1",
@@ -62,6 +63,7 @@
62
63
  "grunt-saucelabs": "^8.6.2",
63
64
  "grunt-shell": "^1.3.0",
64
65
  "jit-grunt": "^0.10.0",
66
+ "phantomjs-prebuilt": "^2.1.7",
65
67
  "time-grunt": "^1.3.0"
66
68
  },
67
69
  "keywords": [