Skip to content

Instantly share code, notes, and snippets.

@tonistiigi
Created June 25, 2012 08:12
Show Gist options
  • Save tonistiigi/2987293 to your computer and use it in GitHub Desktop.
Save tonistiigi/2987293 to your computer and use it in GitHub Desktop.
Color comparison for LimeJS shapes
/**
* Color comparison for LimeJS shapes
* Usage:
* if (sprite.getFill().equals('#c00')) {}
* if (sprite.getFill().equals('rgb(100, 0, 0)')) {}
* if (sprite.getFill().equals(othersprite.getFill())) {}
*/
lime.fill.Color.prototype.equals = function (other) {
other = lime.fill.parse(other);
return this.r == other.r && this.g == other.g && this.b == other.b && this.a == other.a;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment