message: weighted RGB distance works well
diff: @@ -23,7 +23,18 @@ namespace ColorTool
  // heuristic 1: nearest neighbor in RGB space
  // tup => Distance(RGB(c1), RGB(tup.Item1));
  // heuristic 2: nearest neighbor in RGB space
  - tup => Distance(HSV(c1), HSV(tup.Item1));
  + // tup => Distance(HSV(c1), HSV(tup.Item1));
  + // heuristic 3: weighted RGB L2 distance
  + tup => WeightedRGBSimilarity(c1, tup.Item1);
  +
  + private static double WeightedRGBSimilarity(uint c1, uint c2)
  + {
  + var rgb1 = RGB(c1);
  + var rgb2 = RGB(c2);
  + var dist = rgb1.Zip(rgb2, (a, b) => Math.Pow((int)a - (int)b, 2)).ToArray();
  + var rbar = (rgb1[0] + rgb1[0]) / 2.0;
  + return Math.Sqrt(dist[0] * (2 + rbar / 256.0) + dist[1] * 4 + dist[2] * (2 + (255 - rbar) / 256.0));
  + }
  private static double Distance(uint[] c1c, uint[] c2c)
  => Math.Sqrt(c1c.Zip(c2c, (a, b) => Math.Pow((int)a - (int)b, 2)).Sum());
  