I am trying to generate the below Color Gradient ( the Color is blue at one end, and red at the other).
I follow the suggestion put forth here. This is my code:
int rMax = Color.Red.R;
int rMin = Color.Blue.R;
// ... and for B, G
var colorList = new List<Color>();
for(int i=0; i<size; i++)
{
var rAverage = rMin + (int)((rMax - rMin) * i / size);
// ... and for B, G
colorList.Add(Color.FromArgb(rAverage, gAverage, bAverage));
}
Although the result I did show a gradual, smooth transition from Red to Blue, but other intermediate color such as yellow and green didn't show up at all.
Anything I did wrong?