double (Color c1, Color c2) { double rmean = (c1.getRed() + c2.getRed()) / 2.0; int r = c1.getRed() - c2.getRed(); int g = c1.getGreen() - c2.getGreen(); int b = c1.getBlue() - c2.getBlue(); double weightR = 2 + rmean / 256; double weightG = 4.0; double weightB = 2 + (255 - rmean) / 256; return Math.sqrt(weightR * r * r + weightG * g * g + weightB * b * b); }