Type Default Value Read Only Static Description
String "0,0,0,255" No No The color as a string.
Notes

Allows you to get or set a color from a string.

For Gray colors specify two values separated by a comma: gray and alpha. Values should be between 0 and 255.

For RGB colors specify four values separated by a comma: red, green, blue and alpha. Values should be between 0 and 255.

For CMYK colors specify five values separated by a comma: cyan, magenta, yellow, black and alpha. Values should be between 0 and 255.

See Also

Specifying Colors.

Example

[C#]XColor color = new XColor();
color.String = "red";
Response.Write("<b>Red decomposes into</b><br>");
Response.Write("Red = " + color.Red.ToString() + "<br>");
Response.Write("Green = " + color.Green.ToString() + "<br>");
Response.Write("Blue = " + color.Blue.ToString() + "<br>");
color.String = "green";
Response.Write("<b>Green decomposes into</b><br>");
Response.Write("Red = " + color.Red.ToString() + "<br>");
Response.Write("Green = " + color.Green.ToString() + "<br>");
Response.Write("Blue = " + color.Blue.ToString() + "<br>");


[Visual Basic]Dim color As New XColor
color.String = "red"
Response.Write("<b>Red decomposes into</b><br>")
Response.Write("Red = " + color.Red.ToString() + "<br>")
Response.Write("Green = " + color.Green.ToString() + "<br>")
Response.Write("Blue = " + color.Blue.ToString() + "<br>")
color.String = "green"
Response.Write("<b>Green decomposes into</b><br>")
Response.Write("Red = " + color.Red.ToString() + "<br>")
Response.Write("Green = " + color.Green.ToString() + "<br>")
Response.Write("Blue = " + color.Blue.ToString() + "<br>")


The above produces the following output.

Red decomposes into
Red = 86.83058
Green = 3.434437
Blue = 2.601103
Green decomposes into
Red = 0
Green = 39.48376
Blue = 6.936275