Class HexStringHelper
public static class HexStringHelper
- Inheritance
-
HexStringHelper
- Inherited Members
Methods
FormatHexColor(Color32, int)
Formats a hex color, where size represents the amount of letters used to describe the color, defaulting to 6 or 8 depending on if the alpha channel is 255.
public static string FormatHexColor(Color32 color, int size = -1)
Parameters
colorColor32sizeint
Returns
FormatHexColor(Color32, Span<char>)
Formats a hex color, the length/format of which is based on the size of output.
public static int FormatHexColor(Color32 color, Span<char> output)
Parameters
Returns
ParseColor(ReadOnlySpan<char>, IFormatProvider?, bool)
Parse a UnityEngine.Color value.
public static Color ParseColor(ReadOnlySpan<char> hex, IFormatProvider? formatProvider = null, bool throwOnError = true)
Parameters
hexReadOnlySpan<char>formatProviderIFormatProviderthrowOnErrorbool
Returns
- Color
Exceptions
ParseColor32(ReadOnlySpan<char>, IFormatProvider?, bool)
Parse a UnityEngine.Color32 value.
public static Color32 ParseColor32(ReadOnlySpan<char> hex, IFormatProvider? formatProvider = null, bool throwOnError = true)
Parameters
hexReadOnlySpan<char>formatProviderIFormatProviderthrowOnErrorbool
Returns
- Color32
Exceptions
TryParseColor(ReadOnlySpan<char>, IFormatProvider?, out Color)
Parses a string in the following formats: '[#]rrggbb[aa]', '[#]rgb[a]', '[#]g[a]', 'colorname', 'rgb(0, 0, 0[, 0])', 'hsv(0, 0, 0[, 0])', '(0, 0, 0[, 0])'.
public static bool TryParseColor(ReadOnlySpan<char> str, IFormatProvider? formatProvider, out Color color)
Parameters
strReadOnlySpan<char>formatProviderIFormatProvidercolorColor
Returns
TryParseColor32(ReadOnlySpan<char>, IFormatProvider?, out Color32)
Parses a string in the following formats: '[#]rrggbb[aa]', '[#]rgb[a]', '[#]g[a]', 'colorname', 'rgb(0, 0, 0[, 0])', 'hsv(0, 0, 0[, 0])', '(0, 0, 0[, 0])'.
public static bool TryParseColor32(ReadOnlySpan<char> str, IFormatProvider? formatProvider, out Color32 color)
Parameters
strReadOnlySpan<char>formatProviderIFormatProvidercolorColor32
Returns
TryParseHexColor32(ReadOnlySpan<char>, out Color32)
Parses a string in the following formats: '[#]rrggbb[aa]', '[#]rgb[a]', '[#]g[a]'.
public static bool TryParseHexColor32(ReadOnlySpan<char> hex, out Color32 color)
Parameters
hexReadOnlySpan<char>colorColor32