src/main/java/mezz/jei/util/color/ColorUtil.java
public static double slowPerceptualColorDistanceSquared(int[] color1, int[] color2) {
		final double colorDistance = fastPerceptualColorDistanceSquared(color1, color2);

		final double grey1 = (color1[0] + color1[1] + color1[2]) / 3;
		final double grey2 = (color2[0] + color2[1] + color2[2]) / 3;
		final double greyDistance1 = Math.abs(grey1 - color1[0]) + Math.abs(grey1 - color1[1]) + Math.abs(grey1 - color1[2]);
		final double greyDistance2 = Math.abs(grey2 - color2[0]) + Math.abs(grey2 - color2[1]) + Math.abs(grey2 - color2[2]);
		final double greyDistance = greyDistance1 - greyDistance2;

		return colorDistance + (greyDistance * greyDistance / 10.0);
	}
/**
	 * http://www.compuphase.com/cmetric.htm
	 * http://stackoverflow.com/a/6334454
	 * Returns 0 for equal colors, nonzero for colors that look different.
	 * The return value is farther from 0 the more different the colors look.
	 *
	 * Weighs the distance from grey more heavily, to avoid matching grey and colorful colors together.
	 */


Weighs the distance from grey more heavily, to avoid matching grey and colorful colors together.
Weighs the distance from grey more heavily to avoid matching grey and colorful colors together .
public static double slowPerceptualColorDistanceSquared(int[] color1, int[] color2) {
		final double colorDistance = fastPerceptualColorDistanceSquared(color1, color2);
		final double grey1 = (color1[0] + color1[1] + color1[2]) / 3;
		final double grey2 = (color2[0] + color2[1] + color2[2]) / 3;
		final double greyDistance1 = Math.abs(grey1 - color1[0]) + Math.abs(grey1 - color1[1]) + Math.abs(grey1 - color1[2]);
		final double greyDistance2 = Math.abs(grey2 - color2[0]) + Math.abs(grey2 - color2[1]) + Math.abs(grey2 - color2[2]);
		final double greyDistance = greyDistance1 - greyDistance2;
		return colorDistance + (greyDistance * greyDistance / 10.0);
	}
public static double slowPerceptualColorDistanceSquared ( int [ ] color1 , int [ ] color2 ) { final double colorDistance = fastPerceptualColorDistanceSquared ( color1 , color2 ) ; final double grey1 = ( color1 [ 0 ] + color1 [ 1 ] + color1 [ 2 ] ) / 3 ; final double grey2 = ( color2 [ 0 ] + color2 [ 1 ] + color2 [ 2 ] ) / 3 ; final double greyDistance1 = Math . abs ( grey1 - color1 [ 0 ] ) + Math . abs ( grey1 - color1 [ 1 ] ) + Math . abs ( grey1 - color1 [ 2 ] ) ; final double greyDistance2 = Math . abs ( grey2 - color2 [ 0 ] ) + Math . abs ( grey2 - color2 [ 1 ] ) + Math . abs ( grey2 - color2 [ 2 ] ) ; final double greyDistance = greyDistance1 - greyDistance2 ; return colorDistance + ( greyDistance * greyDistance / 10.0 ) ; }
http://www.compuphase.com/cmetric.htm
 http://stackoverflow.com/a/6334454
 Returns 0 for equal colors, nonzero for colors that look different.
http : // www . compuphase . com / cmetric . htm http : // stackoverflow . com / a / 6334454 Returns 0 for equal colors nonzero for colors that look different .