diff --git a/src/Color.php b/src/Color.php index ce322a2..d08e085 100644 --- a/src/Color.php +++ b/src/Color.php @@ -127,4 +127,11 @@ public static function fromRGBA(int $code) : Color{ public function toRGBA() : int{ return ($this->r << 24) | ($this->g << 16) | ($this->b << 8) | $this->a; } + + /** + * Returns whether the two colors are equivalent. + */ + public function equals(self $other) : bool{ + return $this->a === $other->a && $this->r === $other->r && $this->g === $other->g && $this->b === $other->b; + } }