private static Brush InterpolateColor(double value, double max) { value = (int)Math.Round(value * 255.0 / max); if (value > 255) value = 255; else if (value < 0) value = 0; return new SolidColorBrush(Color.FromArgb(127, 255, (byte)value, 0)); }