public Color Interpolate(double value) { var index = MidValues.IndexOf(MidValues.First(v => v >= value)); index = index == Interpolations.Count ? Interpolations.Count - 1 : index; return(Interpolations[index].Interpolate(value, MidValues[index - 1], MidValues[index])); }
public Color Interpolate(double value) { if (value < MinValue) { return(Colors.First()); } else if (value > MaxValue) { return(Colors.Last()); } var index = MidValues.IndexOf(MidValues.First(v => v >= value)); return(Colors[index == 0 ? 0 : index - 1]); }