I used this excellent SO post to figure out how to get different shades and tints of a chosen color, but now I'm hoping to improve the algorithm. Colors in the middle range (with RGB's that add up to about 400 to 500) produce excellent results like those seen in rows 2 and 4 below. But colors outside of that range result in something more like what you see in rows 1 and 3 where the lighter colors don't fade out very much. I think I need to adjust my multiplier to correct this problem, but my math skills just aren't up to it.
private void getShadesAndTints(Color c)
{
int i; Double m;
int r; int g; int b;
for (i = 1; i < 21; i++)
{
m = i * 0.1;
r = (int)(c.R * m); if (r > 255) r = 255;
g = (int)(c.G * m); if (g > 255) g = 255;
b = (int)(c.B * m); if (b > 255) b = 255;
colorList.Add(Color.FromArgb(r, g, b));
}
}
If you want to try it out for yourself, full code is available at: http://pastebin.com/QgCseY4k