-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Equality operator support #3
Comments
This makes sense and seems useful. But isn't hex representation only one perspective ? This is a scenario playing with your proposition of the equality operator and internal representation (which is HSL).
I'm not sure what we gain. Did you have some usage in mind to explicit what would be "very nice" if color had an equality operator support ? Would it loose it's niceness if any other representation would be used to compare color value instead of hex value ? Just wanted to hear your ideas before integrating your code. Thank your for your interest ! |
For further reference on this topic, even if not used. Visual difference between two colors has been standardised. And thus, with a maximum difference, a near-perfect standardised way of comparing if two colors would be perceived as different(or equal) by a human eye would be implementable. More info: http://en.wikipedia.org/wiki/Color_difference And there's a python module that is oriented towards all the mathematical aspect of color management: https://github.com/gtaylor/python-colormath Here's the So In the short term, I'm heading towards the RGB comparison because this is an equality for the computer display software and close to hardware implementation in most case. And it's a rough estimation of human visual difference that is better than HSL in the sense that it'll be able to tell that a black green and a black red are both the same color visually. |
It would be very nice if Color objects had equality operator support. Defining
__eq__
and__ne__
methods in Color class would suffice:This would allow the following syntax to evaluate as True:
The text was updated successfully, but these errors were encountered: