Method TryParse
TryParse(string?, IFormatProvider?, out Color)
[Pure]
public static bool TryParse(string? text, IFormatProvider? formatProvider, out Color result)
Parameters
textstringThe 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.
formatProviderIFormatProviderOptional IFormatProvider to provide formatting services for the input text.
Defaults to InvariantCulture if null.resultColorThe 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
textReadOnlySpan<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.
formatProviderIFormatProviderIf specified and not null, will be passed to Parse(ReadOnlySpan<char>, IFormatProvider?).
colorColorThe 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
utf8TextReadOnlySpan<byte>The span of UTF-8 characters to parse.
providerIFormatProviderAn object that provides culture-specific formatting information about
utf8Text.resultColorOn return, contains the result of successfully parsing
utf8Textor 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
textstringThe 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.
colorColor?The parsed value.
Returns
- bool
A boolean value indicating whether parsing was successful.