Closed WendellLiu closed 8 years ago
I think you'd have quite better result if you implemented getNearestColor with HSV or HSL (which can be done easily with colorsys from the standard lib (#BatteriesIncluded). Then it might be interesting to multiply either component with a scalar constant to change their relative importance.
Worth noting that Wikipedia has an article on color difference which point to rather using L*a*b
and Python-colormap has specific functions for computing visually correct color distances.
Main point is : computing distance by doing an euclidean distance over RGB coordinates does not result with the visually closest color.
thanks all! I will fix my problem as soon as possible
@christoga I'm confused why i should change the colors with material design color. what's advantage in this way?
thanks for your suggestion
I think @christoga wanted to say that Material Design offers a palette of colors that should look better. That could be interesting as an option, if we could choose our palette, but given the goal of this pull request, using the official LEGO colors should be the main feature we add ... we can still add the option to chose a better palette in a subsequent PR based on what this one offers, though.
I'm still trying to find a fix for something before I merge this, and I'll probably be implementing the nearest color in a different way. Great stuff though
better merge has been merged
i just add a function "getNearestColor" in legofy
BTW, tests/nearestColor.py was made for me to test the function and you don't have to merge this on main project