Method TryParse
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.
Remarks
TryParse(string?, IFormatProvider?, out Color)
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 Terminal.Gui.Drawing.Color.GetClosestNamedColor16(Terminal.Gui.Drawing.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.
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)
static bool TryParse(ReadOnlySpan<byte> utf8Text, IFormatProvider? provider, out Color result)
Parameters
utf8TextReadOnlySpan<byte>providerIFormatProviderresultColor