[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] easy way to check pygame.Color() equality?



Maybe comparing their hsva or hsla values instead?

-Thiago

On Mon, Jan 12, 2009 at 9:24 AM, Jake b <ninmonkeys@xxxxxxxxx> wrote:
> How do I check for color equality?
>
>>>> r = pygame.Color("red")
>>>> r == pygame.Color("red")
> returns False # expected True, since I don't care if they are the same
> instance of a Color() class
>
> I thought it would be an equality test., like this: [ The print out has
> equivalent values. ]
>
> def ceq(c1,c2):
>     return c1.r == c2.r and c1.g == c2.g and c1.b == c2.b and c1.a == c2.a
> --
> Jake
>