Table of Contents

Class HexStringHelper

Namespace
Uncreated.Warfare.Util
Assembly
Uncreated.Warfare.dll
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

color Color32
size int

Returns

string

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

color Color32
output Span<char>

Returns

int

ParseColor(ReadOnlySpan<char>, IFormatProvider?, bool)

Parse a UnityEngine.Color value.

public static Color ParseColor(ReadOnlySpan<char> hex, IFormatProvider? formatProvider = null, bool throwOnError = true)

Parameters

hex ReadOnlySpan<char>
formatProvider IFormatProvider
throwOnError bool

Returns

Color

Exceptions

FormatException

ParseColor32(ReadOnlySpan<char>, IFormatProvider?, bool)

Parse a UnityEngine.Color32 value.

public static Color32 ParseColor32(ReadOnlySpan<char> hex, IFormatProvider? formatProvider = null, bool throwOnError = true)

Parameters

hex ReadOnlySpan<char>
formatProvider IFormatProvider
throwOnError bool

Returns

Color32

Exceptions

FormatException

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

str ReadOnlySpan<char>
formatProvider IFormatProvider
color Color

Returns

bool

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

str ReadOnlySpan<char>
formatProvider IFormatProvider
color Color32

Returns

bool

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

hex ReadOnlySpan<char>
color Color32

Returns

bool