Comparing version 4.3.2 to 4.3.3
@@ -1188,5 +1188,5 @@ /*! | ||
/** | ||
* @author Markus Näsman | ||
* @copyright 2012 (c) Markus Näsman <markus at botten dot org > | ||
* @license Copyright (c) 2012, Markus Näsman | ||
* @author Markus Ekholm | ||
* @copyright 2012-2015 (c) Markus Ekholm <markus at botten dot org > | ||
* @license Copyright (c) 2012-2015, Markus Ekholm | ||
* All rights reserved. | ||
@@ -1207,3 +1207,3 @@ * Redistribution and use in source and binary forms, with or without | ||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
* DISCLAIMED. IN NO EVENT SHALL MARKUS NÄSMAN BE LIABLE FOR ANY | ||
* DISCLAIMED. IN NO EVENT SHALL MARKUS EKHOLM BE LIABLE FOR ANY | ||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
@@ -1305,5 +1305,5 @@ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
/** | ||
* @author Markus Näsman | ||
* @copyright 2012 (c) Markus Näsman <markus at botten dot org > | ||
* @license Copyright (c) 2012, Markus Näsman | ||
* @author Markus Ekholm | ||
* @copyright 2012-2015 (c) Markus Ekholm <markus at botten dot org > | ||
* @license Copyright (c) 2012-2015, Markus Ekholm | ||
* All rights reserved. | ||
@@ -1324,3 +1324,3 @@ * Redistribution and use in source and binary forms, with or without | ||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
* DISCLAIMED. IN NO EVENT SHALL MARKUS NÄSMAN BE LIABLE FOR ANY | ||
* DISCLAIMED. IN NO EVENT SHALL MARKUS EKHOLM BE LIABLE FOR ANY | ||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
@@ -1488,11 +1488,20 @@ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
var result = color.map_palette([target], relative); | ||
var result = color.map_palette([target], relative, 'closest'); | ||
return result[key]; | ||
}; | ||
color.furthest = function(target, relative) { | ||
var key = color.palette_map_key(target); | ||
var result = color.map_palette([target], relative, 'furthest'); | ||
return result[key]; | ||
}; | ||
},{}],17:[function(require,module,exports){ | ||
/** | ||
* @author Markus Näsman | ||
* @copyright 2012 (c) Markus Näsman <markus at botten dot org > | ||
* @license Copyright (c) 2012, Markus Näsman | ||
* @author Markus Ekholm | ||
* @copyright 2012-2015 (c) Markus Ekholm <markus at botten dot org > | ||
* @license Copyright (c) 2012-2015, Markus Ekholm | ||
* All rights reserved. | ||
@@ -1513,3 +1522,3 @@ * Redistribution and use in source and binary forms, with or without | ||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
* DISCLAIMED. IN NO EVENT SHALL MARKUS NÄSMAN BE LIABLE FOR ANY | ||
* DISCLAIMED. IN NO EVENT SHALL MARKUS EKHOLM BE LIABLE FOR ANY | ||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
@@ -1553,7 +1562,9 @@ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
* @param [{rgbcolor}] b each element should have fields R,G,B | ||
* @param 'type' should be the string 'closest' or 'furthest' | ||
* @return {palettemap} | ||
*/ | ||
function map_palette(a, b) | ||
function map_palette(a, b, type) | ||
{ | ||
var c = {}; | ||
type = type || 'closest'; | ||
for (var idx1 in a){ | ||
@@ -1567,7 +1578,15 @@ var color1 = a[idx1]; | ||
var current_color_diff = diff(color1,color2); | ||
if((best_color == undefined) || (current_color_diff < best_color_diff)) | ||
if((best_color == undefined) || ((type === 'closest') && (current_color_diff < best_color_diff))) | ||
{ | ||
best_color = color2; | ||
best_color_diff = current_color_diff; | ||
continue; | ||
} | ||
if((type === 'furthest') && (current_color_diff > best_color_diff)) | ||
{ | ||
best_color = color2; | ||
best_color_diff = current_color_diff; | ||
continue; | ||
} | ||
} | ||
@@ -1574,0 +1593,0 @@ c[palette_map_key(color1)] = best_color; |
{ | ||
"name": "magicpen", | ||
"version": "4.3.2", | ||
"version": "4.3.3", | ||
"description": "Styled output in both consoles and browsers", | ||
@@ -35,3 +35,3 @@ "main": "./lib/MagicPen.js", | ||
"ansi-styles": "2.0.0", | ||
"color-diff": "0.1.4", | ||
"color-diff": "0.1.6", | ||
"supports-color": "1.2.0" | ||
@@ -38,0 +38,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
531027
3337
+ Addedcolor-diff@0.1.6(transitive)
- Removedcolor-diff@0.1.4(transitive)
Updatedcolor-diff@0.1.6