public override System.Drawing.Color? GetHintColor(Horse horse, double minBreedValue, double maxBreedValue) { if (horse.CachedBreedValue.HasValue == false) { return DefaultIgnoredHintColor; } if (horse.CachedBreedValue == double.PositiveInfinity) { return DefaultExcludedHintColor; } CustomColors.HSLColor color = new CustomColors.HSLColor(); color.Luminosity = 210D; color.Saturation = 240D; color.Hue = 35D; //0 is red, 35 is yellow, 70 is green //for best candidate (maxBreedValue) name-only highlights: HSLColor(120D, 240D, 180D) double spectrum = Math.Max(Math.Abs(minBreedValue), Math.Abs(maxBreedValue)); //normalize breed value to the spectrum double normalizedBValue = horse.CachedBreedValue.Value / spectrum; color.Hue += normalizedBValue * 35; return color; }
void AdjustColor() { HSLColor color = new HSLColor((double)trackBar1.Value, (double)trackBar2.Value, (double)trackBar3.Value); textBoxColor.Text = color.ToString(); listView1.Items[1].BackColor = (Color)color; }
private static double GetTemp2(HSLColor hslColor) { double temp2; if (hslColor.luminosity < 0.5) //<=?? temp2 = hslColor.luminosity * (1.0 + hslColor.saturation); else temp2 = hslColor.luminosity + hslColor.saturation - (hslColor.luminosity * hslColor.saturation); return temp2; }