Highlight color name#110
Conversation
|
Sorry, I'm no expert on colour spaces, but this looks really arbitrary and fragile. Why is the test for "red and green dominate" inconsistent with "red and blue dominate"? Why the choice of these five colours (red / green / blue / yellow / purple)? The last series of nested ifs is also oddly unbalanced (e.g., if red and green are exactly the same it's yellow, otherwise it could flip to any of purple, red, or green depending on a 1 bit change in any of the R/G/B values). I think this approach would cause more confusion than it helps anyone. Colour names are inherently subjective anyway, so I suspect a better approach would be:
|
|
This code is arbitrary, I agree. The reason I chose this approach was mainly for simplicity (that's why there are only 5 colors, in my experience those are the most common). Other, was that databases produced answers that sometimes were not clear (eg. " khaki", "turquoise", "misty rose", "tomato") in contrast to basic ones. I've noticed that purple has a lot more "room" to stay purple, but in yellow's case at same values it would be regarded more as green than yellow. I'd agree that it's fragile, as this enhancement as I've come to understand, would be unnecessary hard to implement and I tried my best to keep it simple without external libraries. Your suggestion has merit as there are databases ( |
Issue #109
Simple way of getting the names of colors. Tested on iOS and Firefox highlights.
What do you think?