cpp-terminal 1.0.0
Small C++ library for writing multiplatform terminal applications
|
#include <cpp-terminal/color.hpp>
Public Types | |
enum class | Type : std::uint8_t { Unset , NoColor , Bit3 , Bit4 , Bit8 , Bit24 } |
enum class | Name : std::uint8_t { Black = 0 , Red = 1 , Green = 2 , Yellow = 3 , Blue = 4 , Magenta = 5 , Cyan = 6 , White = 7 , Default = 9 , Gray = 60 , BrightBlack = 60 , BrightRed = 61 , BrightGreen = 62 , BrightYellow = 63 , BrightBlue = 64 , BrightMagenta = 65 , BrightCyan = 66 , BrightWhite = 67 } |
The 3bit/4bit colors for the terminal. More... | |
Public Member Functions | |
bool | operator== (const Color &) const |
bool | operator!= (const Color &) const |
Color () | |
Color (const Term::Color::Name &name) | |
Color (const std::uint8_t &color) | |
Color (const std::uint8_t &red, const std::uint8_t &green, const std::uint8_t &blue) | |
Type | getType () const |
Name | to3bits () const |
Name | to4bits () const |
std::uint8_t | to8bits () const |
std::array< std::uint8_t, 3 > | to24bits () const |
Private Attributes | ||
Type | m_Type {Type::Unset} | |
union { | ||
std::uint8_t m_bit8 | ||
std::array< std::uint8_t, 3 > m_bit24 | ||
}; | ||
|
strong |
The 3bit/4bit colors for the terminal.
Get the foreground color: Color4 + 30, Background color: Color4 + 40 See https://en.wikipedia.org/wiki/ANSI_escape_code#3-bit_and_4-bit.
Definition at line 39 of file color.hpp.
|
strong |
Term::Color::Color | ( | const Term::Color::Name & | name | ) |
Term::Color::Color | ( | const std::uint8_t & | red, |
const std::uint8_t & | green, | ||
const std::uint8_t & | blue ) |
Term::Color::Type Term::Color::getType | ( | ) | const |
bool Term::Color::operator!= | ( | const Color & | color | ) | const |
bool Term::Color::operator== | ( | const Color & | color | ) | const |
std::array< std::uint8_t, 3 > Term::Color::to24bits | ( | ) | const |
Term::Color::Name Term::Color::to3bits | ( | ) | const |
Definition at line 39 of file color.cpp.
Term::Color::Name Term::Color::to4bits | ( | ) | const |
Definition at line 48 of file color.cpp.
std::uint8_t Term::Color::to8bits | ( | ) | const |
Definition at line 64 of file color.cpp.
union { ... } Term::Color |
|
private |
Definition at line 73 of file color.hpp.