Exemplo n.º 1
0
        // ******************************************************************
        private bool IsFarEnoughFromExistingColor(Color c, double distanceMin)
        {
            foreach (var coloRatio in UsedColors)
            {
                // double distance = ColorSpaceHelper.GetColorDistance(c, coloRatio.Color);

                // This is a lot better differences between color with CIELab calc.
                var distance = ColorSpaceHelper.GetColorDistanceCIELab(c, coloRatio.Color) / 100;

                if (distance / coloRatio.KeepAwayRatio < distanceMin)
                {
                    return(false); // Too close
                }
            }

            return(true);
        }
Exemplo n.º 2
0
 public Color ToColor()
 {
     return(ColorSpaceHelper.HSLtoColor(hue, saturation, luminance));
 }