Sunday, December 07, 2008

Creating a color list

While setting up an ASP.Net Pie Chart Control, I wanted to create some sets of colors for subcategories within the chart.

To do this, I tried code like:

private List PieChartColorList(Color baseColor)
{
List list = new List();
list.Add(baseColor);
for (int i = 0; i < 5; i++)
{
list.Add(System.Windows.Forms.ControlPaint.Dark(baseColor, 0.25F - i * 0.05F));
list.Add(System.Windows.Forms.ControlPaint.Light(baseColor, 0.25F- i * 0.05F));
}
return list;
}

using the ControlPaint tip from (http://www.csharp411.com/lighten-and-darken-colors-in-net/) - but it didn't work very well....

No comments:

Post a Comment