I want to call a method with argument color. But there are a lot of colors which differ only by a shade. How can I find the colors which differ from my color only by little,
Could you use a method like this:
public bool AreColorsSimilar(Color c1, Color c2, int tolerance)
{
return Math.Abs(c1.R - c2.R) < tolerance &&
Math.Abs(c1.G - c2.G) < tolerance &&
Math.Abs(c1.B - c2.B) < tolerance;
}
This method takes two colours and a tolerance and returns whether those two colours are close or not based on their RGB values. I think that should do the trick but you may need to extend to include brightness and saturation.