[]
Converts a color string to a Color object.
Supported formats include RGB expressions such as "rgb(255,0,0)",
RGBA expressions such as "rgba(255,0,0,0.5)", hexadecimal values such
as "#F00" and "#FF0000", hexadecimal values with alpha such as
"#F00C" and "#FF0000CC", and predefined color names such as
"red".
If the input cannot be parsed, this method returns a fully transparent color.
public static Color StringToColor(string colorString)
Public Shared Function StringToColor(colorString As String) As Color
| Type | Name | Description |
|---|---|---|
| string | colorString | The color string to convert. This value may be |
| Type | Description |
|---|---|
| Color | The Color represented by |
Color fillColor = ColorUtilities.StringToColor("rgba(255,0,0,0.5)");
worksheet.Range["B2"].Interior.Color = fillColor;