Monday, December 08, 2008

More on chart colors...

The Palette object (used in Dundas and Microsoft Charts) has been thoroughly dissected and document here - these arrays might help me make my code output look less ugly in the future? (Might)


public static Color[] GetColorPalette(ChartColorPalette palette, bool isSemiTranparent)
{
Color[] paletteColors = null;
int colorAlpha;
if (isSemiTranparent)
colorAlpha = 200;
else
colorAlpha = 255;

switch (palette)
{
case ChartColorPalette.Berry:
paletteColors = new Color[11];
paletteColors[0] = Color.FromArgb(colorAlpha, 138, 43, 226);
paletteColors[1] = Color.FromArgb(colorAlpha, 186, 85, 211);
paletteColors[2] = Color.FromArgb(colorAlpha, 65, 105, 225);
paletteColors[3] = Color.FromArgb(colorAlpha, 199, 21, 133);
paletteColors[4] = Color.FromArgb(colorAlpha, 0, 0, 255);
paletteColors[5] = Color.FromArgb(colorAlpha, 138, 43, 226);
paletteColors[6] = Color.FromArgb(colorAlpha, 218, 112, 214);
paletteColors[7] = Color.FromArgb(colorAlpha, 123, 104, 238);
paletteColors[8] = Color.FromArgb(colorAlpha, 192, 0, 192);
paletteColors[9] = Color.FromArgb(colorAlpha, 0, 0, 205);
paletteColors[10] = Color.FromArgb(colorAlpha, 128, 0, 128);
break;
case ChartColorPalette.Chocolate:
paletteColors = new Color[10];
paletteColors[0] = Color.FromArgb(colorAlpha, 160, 82, 45);
paletteColors[1] = Color.FromArgb(colorAlpha, 210, 105, 30);
paletteColors[2] = Color.FromArgb(colorAlpha, 139, 0, 0);
paletteColors[3] = Color.FromArgb(colorAlpha, 205, 133, 63);
paletteColors[4] = Color.FromArgb(colorAlpha, 165, 42, 42);
paletteColors[5] = Color.FromArgb(colorAlpha, 244, 164, 96);
paletteColors[6] = Color.FromArgb(colorAlpha, 139, 69, 19);
paletteColors[7] = Color.FromArgb(colorAlpha, 192, 64, 0);
paletteColors[8] = Color.FromArgb(colorAlpha, 178, 34, 34);
paletteColors[9] = Color.FromArgb(colorAlpha, 182, 92, 58);
break;
case ChartColorPalette.Default:
paletteColors = new Color[16];
paletteColors[0] = Color.FromArgb(colorAlpha, 0, 128, 0);
paletteColors[1] = Color.FromArgb(colorAlpha, 0, 0, 255);
paletteColors[2] = Color.FromArgb(colorAlpha, 128, 0, 128);
paletteColors[3] = Color.FromArgb(colorAlpha, 0, 255, 0);
paletteColors[4] = Color.FromArgb(colorAlpha, 255, 0, 255);
paletteColors[5] = Color.FromArgb(colorAlpha, 0, 128, 128);
paletteColors[6] = Color.FromArgb(colorAlpha, 255, 255, 0);
paletteColors[7] = Color.FromArgb(colorAlpha, 128, 128, 128);
paletteColors[8] = Color.FromArgb(colorAlpha, 0, 255, 255);
paletteColors[9] = Color.FromArgb(colorAlpha, 0, 0, 128);
paletteColors[10] = Color.FromArgb(colorAlpha, 128, 0, 0);
paletteColors[11] = Color.FromArgb(colorAlpha, 255, 0, 0);
paletteColors[12] = Color.FromArgb(colorAlpha, 128, 128, 0);
paletteColors[13] = Color.FromArgb(colorAlpha, 192, 192, 192);
paletteColors[14] = Color.FromArgb(colorAlpha, 255, 99, 71);
paletteColors[15] = Color.FromArgb(colorAlpha, 255, 228, 181);
break;
case ChartColorPalette.Dundas:
paletteColors = new Color[15];
paletteColors[0] = Color.FromArgb(colorAlpha, 65, 140, 240);
paletteColors[1] = Color.FromArgb(colorAlpha, 252, 180, 65);
paletteColors[2] = Color.FromArgb(colorAlpha, 224, 64, 10);
paletteColors[3] = Color.FromArgb(colorAlpha, 5, 100, 146);
paletteColors[4] = Color.FromArgb(colorAlpha, 191, 191, 191);
paletteColors[5] = Color.FromArgb(colorAlpha, 26, 59, 105);
paletteColors[6] = Color.FromArgb(colorAlpha, 255, 227, 130);
paletteColors[7] = Color.FromArgb(colorAlpha, 18, 156, 221);
paletteColors[8] = Color.FromArgb(colorAlpha, 202, 107, 75);
paletteColors[9] = Color.FromArgb(colorAlpha, 0, 92, 219);
paletteColors[10] = Color.FromArgb(colorAlpha, 243, 210, 136);
paletteColors[11] = Color.FromArgb(colorAlpha, 80, 99, 129);
paletteColors[12] = Color.FromArgb(colorAlpha, 241, 185, 168);
paletteColors[13] = Color.FromArgb(colorAlpha, 224, 131, 10);
paletteColors[14] = Color.FromArgb(colorAlpha, 120, 147, 190);
break;
case ChartColorPalette.EarthTones:
paletteColors = new Color[16];
paletteColors[0] = Color.FromArgb(colorAlpha, 255, 128, 0);
paletteColors[1] = Color.FromArgb(colorAlpha, 184, 134, 11);
paletteColors[2] = Color.FromArgb(colorAlpha, 192, 64, 0);
paletteColors[3] = Color.FromArgb(colorAlpha, 107, 142, 35);
paletteColors[4] = Color.FromArgb(colorAlpha, 205, 133, 63);
paletteColors[5] = Color.FromArgb(colorAlpha, 192, 192, 0);
paletteColors[6] = Color.FromArgb(colorAlpha, 34, 139, 34);
paletteColors[7] = Color.FromArgb(colorAlpha, 210, 105, 30);
paletteColors[8] = Color.FromArgb(colorAlpha, 128, 128, 0);
paletteColors[9] = Color.FromArgb(colorAlpha, 32, 178, 170);
paletteColors[10] = Color.FromArgb(colorAlpha, 244, 164, 96);
paletteColors[11] = Color.FromArgb(colorAlpha, 0, 192, 0);
paletteColors[12] = Color.FromArgb(colorAlpha, 143, 188, 139);
paletteColors[13] = Color.FromArgb(colorAlpha, 178, 34, 34);
paletteColors[14] = Color.FromArgb(colorAlpha, 139, 69, 19);
paletteColors[15] = Color.FromArgb(colorAlpha, 192, 0, 0);
break;
case ChartColorPalette.Excel:
paletteColors = new Color[16];
paletteColors[0] = Color.FromArgb(colorAlpha, 153, 153, 255);
paletteColors[1] = Color.FromArgb(colorAlpha, 153, 51, 102);
paletteColors[2] = Color.FromArgb(colorAlpha, 255, 255, 204);
paletteColors[3] = Color.FromArgb(colorAlpha, 204, 255, 255);
paletteColors[4] = Color.FromArgb(colorAlpha, 102, 0, 102);
paletteColors[5] = Color.FromArgb(colorAlpha, 255, 128, 128);
paletteColors[6] = Color.FromArgb(colorAlpha, 0, 102, 204);
paletteColors[7] = Color.FromArgb(colorAlpha, 204, 204, 255);
paletteColors[8] = Color.FromArgb(colorAlpha, 0, 0, 128);
paletteColors[9] = Color.FromArgb(colorAlpha, 255, 0, 255);
paletteColors[10] = Color.FromArgb(colorAlpha, 255, 255, 0);
paletteColors[11] = Color.FromArgb(colorAlpha, 0, 255, 255);
paletteColors[12] = Color.FromArgb(colorAlpha, 128, 0, 128);
paletteColors[13] = Color.FromArgb(colorAlpha, 128, 0, 0);
paletteColors[14] = Color.FromArgb(colorAlpha, 0, 128, 128);
paletteColors[15] = Color.FromArgb(colorAlpha, 0, 0, 255);
break;
case ChartColorPalette.Fire:
paletteColors = new Color[10];
paletteColors[0] = Color.FromArgb(colorAlpha, 255, 215, 0);
paletteColors[1] = Color.FromArgb(colorAlpha, 255, 0, 0);
paletteColors[2] = Color.FromArgb(colorAlpha, 255, 20, 147);
paletteColors[3] = Color.FromArgb(colorAlpha, 220, 20, 60);
paletteColors[4] = Color.FromArgb(colorAlpha, 255, 140, 0);
paletteColors[5] = Color.FromArgb(colorAlpha, 255, 0, 255);
paletteColors[6] = Color.FromArgb(colorAlpha, 255, 255, 0);
paletteColors[7] = Color.FromArgb(colorAlpha, 255, 69, 0);
paletteColors[8] = Color.FromArgb(colorAlpha, 199, 21, 133);
paletteColors[9] = Color.FromArgb(colorAlpha, 221, 226, 33);
break;
case ChartColorPalette.GrayScale:
paletteColors = new Color[16];
paletteColors[1] = Color.FromArgb(colorAlpha, 189, 189, 189);
paletteColors[2] = Color.FromArgb(colorAlpha, 178, 178, 178);
paletteColors[3] = Color.FromArgb(colorAlpha, 167, 167, 167);
paletteColors[4] = Color.FromArgb(colorAlpha, 156, 156, 156);
paletteColors[5] = Color.FromArgb(colorAlpha, 145, 145, 145);
paletteColors[6] = Color.FromArgb(colorAlpha, 134, 134, 134);
paletteColors[7] = Color.FromArgb(colorAlpha, 123, 123, 123);
paletteColors[8] = Color.FromArgb(colorAlpha, 112, 112, 112);
paletteColors[9] = Color.FromArgb(colorAlpha, 101, 101, 101);
paletteColors[10] = Color.FromArgb(colorAlpha, 90, 90, 90);
paletteColors[11] = Color.FromArgb(colorAlpha, 79, 79, 79);
paletteColors[12] = Color.FromArgb(colorAlpha, 68, 68, 68);
paletteColors[13] = Color.FromArgb(colorAlpha, 57, 57, 57);
paletteColors[14] = Color.FromArgb(colorAlpha, 46, 46, 46);
paletteColors[15] = Color.FromArgb(colorAlpha, 35, 35, 35);
break;
case ChartColorPalette.Light:
paletteColors = new Color[10];
paletteColors[0] = Color.FromArgb(colorAlpha, 230, 230, 250);
paletteColors[1] = Color.FromArgb(colorAlpha, 255, 240, 245);
paletteColors[2] = Color.FromArgb(colorAlpha, 255, 218, 185);
paletteColors[3] = Color.FromArgb(colorAlpha, 255, 250, 205);
paletteColors[4] = Color.FromArgb(colorAlpha, 255, 228, 225);
paletteColors[5] = Color.FromArgb(colorAlpha, 240, 255, 240);
paletteColors[6] = Color.FromArgb(colorAlpha, 240, 248, 255);
paletteColors[7] = Color.FromArgb(colorAlpha, 245, 245, 245);
paletteColors[8] = Color.FromArgb(colorAlpha, 250, 235, 215);
paletteColors[9] = Color.FromArgb(colorAlpha, 224, 255, 255);
break;
case ChartColorPalette.Pastel:
paletteColors = new Color[16];
paletteColors[0] = Color.FromArgb(colorAlpha, 135, 206, 235);
paletteColors[1] = Color.FromArgb(colorAlpha, 50, 205, 50);
paletteColors[2] = Color.FromArgb(colorAlpha, 186, 85, 211);
paletteColors[3] = Color.FromArgb(colorAlpha, 240, 128, 128);
paletteColors[4] = Color.FromArgb(colorAlpha, 70, 130, 180);
paletteColors[5] = Color.FromArgb(colorAlpha, 154, 205, 50);
paletteColors[6] = Color.FromArgb(colorAlpha, 64, 224, 208);
paletteColors[7] = Color.FromArgb(colorAlpha, 255, 105, 180);
paletteColors[8] = Color.FromArgb(colorAlpha, 240, 230, 140);
paletteColors[9] = Color.FromArgb(colorAlpha, 210, 180, 140);
paletteColors[10] = Color.FromArgb(colorAlpha, 143, 188, 139);
paletteColors[11] = Color.FromArgb(colorAlpha, 100, 149, 237);
paletteColors[12] = Color.FromArgb(colorAlpha, 221, 160, 221);
paletteColors[13] = Color.FromArgb(colorAlpha, 95, 158, 160);
paletteColors[14] = Color.FromArgb(colorAlpha, 255, 218, 185);
paletteColors[15] = Color.FromArgb(colorAlpha, 255, 160, 122);
break;
case ChartColorPalette.SeaGreen:
paletteColors = new Color[10];
paletteColors[0] = Color.FromArgb(colorAlpha, 46, 139, 87);
paletteColors[1] = Color.FromArgb(colorAlpha, 102, 205, 170);
paletteColors[2] = Color.FromArgb(colorAlpha, 70, 130, 180);
paletteColors[3] = Color.FromArgb(colorAlpha, 0, 139, 139);
paletteColors[4] = Color.FromArgb(colorAlpha, 95, 158, 160);
paletteColors[5] = Color.FromArgb(colorAlpha, 60, 179, 113);
paletteColors[6] = Color.FromArgb(colorAlpha, 72, 209, 204);
paletteColors[7] = Color.FromArgb(colorAlpha, 176, 196, 222);
paletteColors[8] = Color.FromArgb(colorAlpha, 143, 188, 139);
paletteColors[9] = Color.FromArgb(colorAlpha, 135, 206, 235);
break;
}

return paletteColors;
}

No comments:

Post a Comment