The task is to get a specific standardized color (it will be referred to as 100% desired purity) by mixing different proposed colors. I could compare their RGB parameters and see if the mixture matches the reference (true/false). However, the condition is that there can be different shades of that desired color. Some of those shades are close to the reference (somewhere between 80% to 90% alike) and some are not (70% and lower). So basically if it has at least 80% similarity you win, lower than that value - you lose. I just can't figure out how to make this color check.
Example: There is an array of possible colors to mix:
Color[] aColors = { new Color(1f, 1f, 0f), new Color(0.3f, 0.9f, 0f),
new Color(1f, 0.6f, 0f), new Color(1f, 0f, 0f),
new Color(0.5f,0f,0f), new Color(0.5f, 0f, 0.9f),
new Color(0f, 0.3f, 0f)};
The reference color is Lime:
Color(0.43f,0.74f,0f)
The correct pick for the mixture from the array is next (mixing yellow and green):
resutColor = aColors[0] + aColors[1]/ 2
When mixing a shade of dark red with green also gives a somewhat lime color and this should be taken into consideration by specifying how close the result is to the reference shade in percentages
A dark red color:
new Color(0.5f,0f,0f)