int GetColorIndex(Color color)
{
color = Color.FromArgb(color.R, color.G, color.B);
int index = UsedColors.IndexOf(color);
if (index < 0) {
index = UsedColors.Count;
UsedColors.Add(color);
if(ColorTable.Length == 0)
ColorTable.Append(@"{\colortbl ");
ColorTable.AppendFormat(@"\red{0}\green{1}\blue{2};", color.R, color.G, color.B);
}
return index;
}