The program is currently filling out charts with colours chosen for it, once the chart exceeds the limit of colours given, it picks a colour at random.
Is there a viable way of acquiring the colour without it being of the same shade as the previous ones?
Code:
public List<string> getColors(int columns)
{
List<string> colors = new List<string>();
colors.Add("\"rgba(77,77,77,0.8)\"");
colors.Add("\"rgba(241,88,84,0.8)\"");
colors.Add("\"rgba(93,165,218,0.8)\"");
colors.Add("\"rgba(96,189,104,0.8)\"");
colors.Add("\"rgba(222,207,63,0.8)\"");
colors.Add("\"rgba(178,118,178,0.8)\"");
colors.Add("\"rgba(187,253,241,0.8)\"");
colors.Add("\"rgba(178,145,47,0.8)\"");
if (columns > colors.Count)
{
Color c = GetRandomColour();
colors.Add(String.Format("\"rgba({0},{1},{2},0.8)\"",
c.R.ToString(), c.G.ToString(), c.B.ToString()));
}
return colors;
}
private static readonly Random rand = new Random();
private Color GetRandomColour()
{
return Color.FromArgb(rand.Next(256), rand.Next(256), rand.Next(256));
}