looks-same
Advanced tools
Comparing version 4.0.0 to 4.1.0
# Changelog | ||
## 4.1.0 - 2018-12-05 | ||
* add ability to ignore antialiasing and caret in "createDiff" method | ||
* add typescript types | ||
## 4.0.0 - 2018-09-11 | ||
@@ -4,0 +9,0 @@ |
10
index.js
@@ -111,3 +111,3 @@ 'use strict'; | ||
if (!options.comparator({color1, color2})) { | ||
if (!options.comparator({color1, color2, png1, png2, x, y, width, height})) { | ||
result.setPixel(x, y, highlightColor); | ||
@@ -217,5 +217,5 @@ } else { | ||
exports.createDiff = function saveDiff(opts, callback) { | ||
const tolerance = getToleranceFromOpts(opts); | ||
opts.tolerance = getToleranceFromOpts(opts); | ||
readPair(opts.reference, opts.current, (error, result) => { | ||
readPair(opts.reference, opts.current, (error, {first, second}) => { | ||
if (error) { | ||
@@ -227,6 +227,6 @@ return callback(error); | ||
highlightColor: parseColorString(opts.highlightColor), | ||
comparator: opts.strict ? areColorsSame : makeCIEDE2000Comparator(tolerance) | ||
comparator: createComparator(first, second, opts) | ||
}; | ||
buildDiffImage(result.first, result.second, diffOptions, (result) => { | ||
buildDiffImage(first, second, diffOptions, (result) => { | ||
if (opts.diff === undefined) { | ||
@@ -233,0 +233,0 @@ result.createBuffer(callback); |
@@ -11,3 +11,3 @@ 'use strict'; | ||
module.exports = class AntialiasingComparator { | ||
constructor(baseComparator, png1, png2, {antialiasingTolerance}) { | ||
constructor(baseComparator, png1, png2, {antialiasingTolerance = 0}) { | ||
this._baseComparator = baseComparator; | ||
@@ -14,0 +14,0 @@ this._img1 = png1; |
{ | ||
"name": "looks-same", | ||
"version": "4.0.0", | ||
"version": "4.1.0", | ||
"description": "Pure node.js library for comparing PNG-images, taking into account human color perception.", | ||
"main": "index.js", | ||
"types": "index.d.ts", | ||
"directories": { | ||
@@ -17,2 +18,3 @@ "test": "test" | ||
"devDependencies": { | ||
"@types/node": "^10.12.3", | ||
"chai": "^4.1.2", | ||
@@ -19,0 +21,0 @@ "eslint": "^5.3.0", |
@@ -96,6 +96,9 @@ # LooksSame | ||
diff: '/path/to/save/diff/to.png', | ||
highlightColor: '#ff00ff', //color to highlight the differences | ||
strict: false,//strict comparsion | ||
tolerance: 2.5 | ||
highlightColor: '#ff00ff', // color to highlight the differences | ||
strict: false, // strict comparsion | ||
tolerance: 2.5, | ||
ignoreAntialiasing: false, // do not ignore antialising by default | ||
ignoreCaret: false // do not ignore caret by default | ||
}, function(error) { | ||
... | ||
}); | ||
@@ -112,3 +115,3 @@ ``` | ||
looksSame.createDiff({ | ||
//exactly same options as above, but without diff | ||
// exactly same options as above, but without diff | ||
}, function(error, buffer) { | ||
@@ -115,0 +118,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
35051
16
776
131
10