Answer the question
In order to leave comments, you need to log in
How to find out the maximum belonging of a color to one of the lists of colors?
There is an array of colors (you can use hex, you can use rgb or cmyk).
The input color is in the same format as the colors in the array (hex, rgb or cmyk).
At the output, you need to understand which color from the array is closest to the input.
Answer the question
In order to leave comments, you need to log in
Have you tried searching? stackoverflow.com/questions/19782975/convert-rgb-c...
If only tint is needed, then try using hsv or hsl
In essence, you need to solve the problem of finding the nearest point in three-dimensional space (a standard problem in three-dimensional space, the solution is googled). Color as such doesn't matter. Take only the space that suits your purposes. For example, if you want to find the closest color in terms of human perception, but you need to use LAB (and compare after converting to it).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question