slang::TextColor class

A color used for styling terminal text.

This is either one of the standard ANSI terminal colors or an arbitrary 24-bit RGB value.

Constructors, destructors, conversion operators

TextColor() defaulted constexpr
Constructs an empty color that applies no styling.
TextColor(TerminalColor color) constexpr noexcept
Constructs a color from one of the standard ANSI terminal colors.

Public functions

bool hasValue() const constexpr noexcept
bool isRgb() const constexpr noexcept
uint32_t rgb() const constexpr noexcept
TerminalColor terminal() const constexpr noexcept

Function documentation

bool slang::TextColor::hasValue() const constexpr noexcept

Returns true if this color specifies any value, otherwise false.

bool slang::TextColor::isRgb() const constexpr noexcept

Returns true if this color is an RGB value, or false if it is a terminal color.

uint32_t slang::TextColor::rgb() const constexpr noexcept

Returns the 24-bit RGB value. Only valid if isRgb() is true.

TerminalColor slang::TextColor::terminal() const constexpr noexcept

Returns the terminal color. Only valid if isRgb() is false.