Table of Contents

Struct ColorRgb

Namespace
DocWright.Core.Primitives
Assembly
DocWright.Core.dll

A 24-bit RGB color, or the special Word "auto" color (ECMA-376 Part 1 §17.18.40 ST_HexColor: either the literal auto or a six-digit hex triplet with no leading '#').

public readonly struct ColorRgb : IEquatable<ColorRgb>
Implements
Inherited Members

Remarks

"auto" is preserved as-is and resolved contextually later (usually to black for text); accessing R, G or B on an auto color throws. Parsing and formatting are strictly culture-independent: hex digits are matched by character range and "auto" by explicit per-character comparison, so behavior is identical under any culture (including tr-TR).

Properties

Auto

Gets the special "auto" color.

B

Gets the blue channel.

Black

Gets black (000000).

G

Gets the green channel.

IsAuto

Gets a value indicating whether this is the "auto" color.

R

Gets the red channel.

White

Gets white (FFFFFF).

Methods

Equals(ColorRgb)
Equals(object?)
FromRgb(byte, byte, byte)

Creates a color from explicit channel values.

GetHashCode()
Parse(string)

Parses an ST_HexColor value: the literal auto (any letter casing) or exactly six hex digits (upper or lower case) with no leading '#'.

ToString()

Formats the color as ST_HexColor: auto, or six uppercase hex digits (for example "1A2B3C"). Culture-independent.

TryParse(ReadOnlySpan<char>, out ColorRgb)

Attempts to parse an ST_HexColor value from a character span. Allocation-free.

TryParse(string?, out ColorRgb)

Attempts to parse an ST_HexColor value. See Parse(string).

Operators

operator ==(ColorRgb, ColorRgb)

Determines whether two colors are equal.

operator !=(ColorRgb, ColorRgb)

Determines whether two colors are not equal.