Click or drag to resize
Ab4d.SharpEngine logo

Color4TryParse Method

TryParse method tries to parse the color text and set the color out parameter. When the color text starts with hash character (#), then the color is specified as a hex value in format RRGGBBAA, RGBA, RRGGBB or RGB (for example #FF0000FF for red color). Otherwise the color text should be one of the color names from the known colors defined in the Colors class. The name can be in any case. When the color be parse, the color is set to the color out parameter and the method returns true. Otherwise color is set to Black color and the methods returns false.

Namespace: Ab4d.SharpEngine.Common
Assembly: Ab4d.SharpEngine (in Ab4d.SharpEngine.dll) Version: 2.0.8956+4c7684e186ca1be74e7a284fbe739d9a1b843d3c
Syntax
C#
public static bool TryParse(
	string? colorText,
	out Color4? color
)

Parameters

colorText  String
color text as hex color (#RRGGBAA, #RGBA, #RRGGBB, #RGB) or color name (Red)
color  Color4
parsed color

Return Value

Boolean
true when the method can parse the color, otherwise false
See Also