public static bool ColorTest(Color32 c1, Color32 c2, Color32 startColor, float tol) { //Those values you can just divide by the amount of difference saturations (255), and you will get the difference between the two. float diffRed = Mathf.Abs(c1.r - c2.r) / 255f; float diffGreen = Mathf.Abs(c1.g - c2.g) / 255f; float diffBlue = Mathf.Abs(c1.b - c2.b) / 255f; //After which you can just find the average color difference in percentage. float diffPercentage = (diffRed + diffGreen + diffBlue) / 3 * 100; if (diffPercentage >= tol) { return(false); } else { // Do HSV comparsion HSVColor color1 = HSVColor.FromRGBA(c1.r / 255f, c1.g / 255f, c1.b / 255f, 1); HSVColor color2 = HSVColor.FromRGBA(startColor.r / 255f, startColor.g / 255f, startColor.b / 255f, 1); // Only for highly saturated colors if (Mathf.Abs(color1.s - color2.s) > 0.5f) { return(false); } return(true); } }