Struct SRgb8
Packed 8-bit encoded-sRGB storage.
struct SRgb8;
Each component is an unsigned byte in encoded sRGB channel space. The type is intended for compact tables, UI/configuration boundaries, renderer interchange, and similar storage-facing uses.
This is not a computational replacement for SRgb!T: it has no implicit
conversion to or from the floating-point color types, and construction does
not perform normalization, clipping, transfer conversion, or gamut mapping.
Fields
| Name | Type | Description |
|---|---|---|
b
|
ubyte | Blue encoded-sRGB byte. |
g
|
ubyte | Green encoded-sRGB byte. |
r
|
ubyte | Red encoded-sRGB byte. |
Methods
| Name | Description |
|---|---|
toHex
()
|
Serializes this byte value as canonical six-digit hexadecimal sRGB. |
toSRgb
()
|
Converts packed encoded-sRGB bytes to normalized computational sRGB. |
Aliases
| Name | Description |
|---|---|
Channel
|
Storage channel type. |
Layout
Exactly three bytes in red, green, blue order:
r at byte 0, g at byte 1, and b at byte 2.
Default
is SRgb8(0, 0, 0).
Example
enum accent = SRgb8(0x24, 0x7A, 0xC4);
static assert(accent .r == 0x24);
static assert(accent .g == 0x7A);
static assert(accent .b == 0xC4);
const copy = accent;
assert(copy == accent);