File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -303,10 +303,12 @@ class exports.Color extends BaseClass
303
303
colorA = new Color (colorA)
304
304
colorB = new Color (colorB)
305
305
306
- return false if Math .round (colorA .r ) isnt Math .round (colorB .r )
307
- return false if Math .round (colorA .g ) isnt Math .round (colorB .g )
308
- return false if Math .round (colorA .b ) isnt Math .round (colorB .b )
309
- return false if Math .round (colorA .a ) isnt Math .round (colorB .a )
306
+ tolerance = 1
307
+ alphaTolerance = 0.01
308
+ return false if Math .abs (colorA .r - colorB .r ) >= tolerance
309
+ return false if Math .abs (colorA .g - colorB .g ) >= tolerance
310
+ return false if Math .abs (colorA .b - colorB .b ) >= tolerance
311
+ return false if Math .abs (colorA .a - colorB .a ) >= alphaTolerance
310
312
return true
311
313
312
314
@ rgbToHsl: (a , b , c ) ->
You can’t perform that action at this time.
0 commit comments