Function SRgb8.toHex

Serializes this byte value as canonical six-digit hexadecimal sRGB.

char[7] toHex() pure nothrow @nogc @safe const;

The result is exactly seven ASCII characters: a leading # followed by two lowercase hexadecimal digits for red, green, and blue.

Returns

Allocation-free char[7] containing #rrggbb.

Example

enum packed = SRgb8(0x12, 0xAB, 0x00);
enum hex = packed.toHex();

static assert(hex[0] == '#');
static assert(hex[1] == '1');
static assert(hex[2] == '2');
static assert(hex[3] == 'a');
static assert(hex[4] == 'b');
static assert(hex[5] == '0');
static assert(hex[6] == '0');
}