Permalink
Browse files

Improve color equality

  • Loading branch information...
jonastreub committed Jun 12, 2017
1 parent bfaf154 commit 714bc246bd0ce97a9c93871d3fa58ecc925bedaa
Showing with 6 additions and 4 deletions.
  1. +6 −4 framer/Color.coffee
View
@@ -303,10 +303,12 @@ class exports.Color extends BaseClass
colorA = new Color(colorA) colorA = new Color(colorA)
colorB = new Color(colorB) colorB = new Color(colorB)
return false if Math.round(colorA.r) isnt Math.round(colorB.r) tolerance = 1
return false if Math.round(colorA.g) isnt Math.round(colorB.g) alphaTolerance = 0.01
return false if Math.round(colorA.b) isnt Math.round(colorB.b) return false if Math.abs(colorA.r - colorB.r) >= tolerance
return false if Math.round(colorA.a) isnt Math.round(colorB.a) return false if Math.abs(colorA.g - colorB.g) >= tolerance
return false if Math.abs(colorA.b - colorB.b) >= tolerance
return false if Math.abs(colorA.a - colorB.a) >= alphaTolerance
return true return true
@rgbToHsl: (a, b, c) -> @rgbToHsl: (a, b, c) ->

0 comments on commit 714bc24

Please sign in to comment.