I am using SSRS reportviewer to generate a report using objects. In my program, I am asking the user to input a string of commonly known colors such as \"Red\"
, \"<
I created a handy extension method.
public static class ColorExtensions
{
...
public static Color WithA(this Color color, int newA) => Color.FromArgb(newA,color);
}
Usage:
newitem.ChartColor = "red";
Color mycolor = Color.FromName(newitem.ChartColor);
Color myColorAlt1 = myColor.WithA(0x56);
Color myColorAlt2 = myColor.WithA(0x28);
or, if you needed it right away:
Color mycolor = Color.FromName(newitem.ChartColor).WithA(0x56);