private void AssignColors(IEnumerable <string> labels) { foreach (string label in labels) { if (!this.LabelColors.ContainsKey(label)) { int labelHashCode = label.GetHashCode(); double hue = 360 * ((double)Math.Abs(labelHashCode)) / int.MaxValue; double[] hsv = new double[3] { hue, 1.0, 255.0 }; Color rgbColor = ColorConversion.FromHSV(hsv); this.labelColors[label] = rgbColor; } } }