Method TryParse
TryParse(string?, IFormatProvider?, out Color)
[Pure]
public static bool TryParse(string? text, IFormatProvider? formatProvider, out Color result)
Parameters
text
stringThe text to analyze. Formats supported are "#RGB", "#RRGGBB", "#ARGB", "#AARRGGBB", "rgb(r,g,b)", "rgb(r,g,b,a)", "rgba(r,g,b)", "rgba(r,g,b,a)", and any of the GetClosestNamedColor16(Color) string values.
formatProvider
IFormatProviderOptional IFormatProvider to provide formatting services for the input text.
Defaults to InvariantCulture if null.result
ColorThe parsed value, if successful, or default(Color), if unsuccessful.
Returns
Remarks
TryParse(ReadOnlySpan<char>, IFormatProvider?, out Color)
Converts the provided ReadOnlySpan<T> of char to a new Color value.
[Pure]
public static bool TryParse(ReadOnlySpan<char> text, IFormatProvider? formatProvider, out Color color)
Parameters
text
ReadOnlySpan<char>The text to analyze. Formats supported are "#RGB", "#RRGGBB", "#ARGB", "#AARRGGBB", "rgb(r,g,b)", "rgb(r,g,b,a)", "rgba(r,g,b)", "rgba(r,g,b,a)", and any W3C color name."/> string values.
formatProvider
IFormatProviderIf specified and not null, will be passed to Parse(ReadOnlySpan<char>, IFormatProvider?).
color
ColorThe parsed value, if successful, or default(Color), if unsuccessful.
Returns
Remarks
TryParse(ReadOnlySpan<byte>, IFormatProvider?, out Color)
Tries to parse a span of UTF-8 characters into a value.
[Pure]
public static bool TryParse(ReadOnlySpan<byte> utf8Text, IFormatProvider? provider, out Color result)
Parameters
utf8Text
ReadOnlySpan<byte>The span of UTF-8 characters to parse.
provider
IFormatProviderAn object that provides culture-specific formatting information about
utf8Text
.result
ColorOn return, contains the result of successfully parsing
utf8Text
or an undefined value on failure.
Returns
TryParse(string, out Color?)
Converts the provided string to a new Color instance.
public static bool TryParse(string text, out Color? color)
Parameters
text
stringThe text to analyze. Formats supported are "#RGB", "#RRGGBB", "#ARGB", "#AARRGGBB", "rgb(r,g,b)", "rgb(r,g,b,a)", "rgba(r,g,b)", "rgba(r,g,b,a)", and any of the ColorName16 string values.
color
Color?The parsed value.
Returns
- bool
A boolean value indicating whether parsing was successful.