@@ -40,6 +40,9 @@ export default function pixelmatch(img1, img2, output, width, height, options) {
40
40
// maximum acceptable square distance between two colors;
41
41
// 35215 is the maximum possible value for the YIQ difference metric
42
42
const maxDelta = 35215 * options . threshold * options . threshold ;
43
+ const [ aaR , aaG , aaB ] = options . aaColor ;
44
+ const [ diffR , diffG , diffB ] = options . diffColor ;
45
+ const [ altR , altG , altB ] = options . diffColorAlt || options . diffColor ;
43
46
let diff = 0 ;
44
47
45
48
// compare each pixel of one image against the other one
@@ -58,12 +61,16 @@ export default function pixelmatch(img1, img2, output, width, height, options) {
58
61
antialiased ( img2 , x , y , width , height , img1 ) ) ) {
59
62
// one of the pixels is anti-aliasing; draw as yellow and do not count as difference
60
63
// note that we do not include such pixels in a mask
61
- if ( output && ! options . diffMask ) drawPixel ( output , pos , ... options . aaColor ) ;
64
+ if ( output && ! options . diffMask ) drawPixel ( output , pos , aaR , aaG , aaB ) ;
62
65
63
66
} else {
64
67
// found substantial difference not caused by anti-aliasing; draw it as such
65
68
if ( output ) {
66
- drawPixel ( output , pos , ...( delta < 0 && options . diffColorAlt || options . diffColor ) ) ;
69
+ if ( delta < 0 ) {
70
+ drawPixel ( output , pos , altR , altG , altB ) ;
71
+ } else {
72
+ drawPixel ( output , pos , diffR , diffG , diffB ) ;
73
+ }
67
74
}
68
75
diff ++ ;
69
76
}
0 commit comments