libzypp
17.35.19
|
Various ways to define ansi SGR sequences. More...
#include <zypp-tui/utils/ansi.h>
Classes | |
union | Comp |
Public Types | |
enum | Attr : std::uint8_t { Attr::Unchanged, Attr::Normal, Attr::Bright, Attr::Reverse } |
Color attributes. More... | |
enum | Fg : std::uint8_t { Fg::Unchanged, Default, Black, Red, Green, Yellow, Blue, Magenta, Cyan, White } |
Foreground colors. More... | |
enum | Bg : std::uint8_t { Bg::Unchanged, Default, Black, Red, Green, Yellow, Blue, Magenta, Cyan, White } |
Backgroud colors. More... | |
enum | Constant : std::uint8_t { Black, Black, Black, BrightBlack, Red, Red, Red, BrightRed, Green, Green, Green, BrightGreen, Yellow, Yellow, Yellow, BrightYellow, Blue, Blue, Blue, BrightBlue, Magenta, Magenta, Magenta, BrightMagenta, Cyan, Cyan, Cyan, BrightCyan, White, White, White, BrightWhite, Default, Default, Default, BrightDefault } |
Predefined (foregreound) color contants Intentionally not an enum class , so it can be used as Color::Red , Color::Default , etc. More... | |
using | UidType = std::uint32_t |
Color unique id type. More... | |
Public Member Functions | |
Color () | |
Default ctor: terminal default color. More... | |
Color (Attr attr_r, Fg fg_r=Fg::Unchanged, Bg bg_r=Bg::Unchanged) | |
Color (Attr attr_r, Bg bg_r) | |
Color (Fg fg_r, Bg bg_r=Bg::Unchanged) | |
Color (Bg bg_r) | |
Color (Constant color_r, Bg bg_r=Bg::Default) | |
Color constant combined with background (Bg::Default) More... | |
template<class CCC_ , typename = EnableIfCustomColorCtor<CCC_>> | |
Color (CCC_ &&color_r) | |
Custom ctor from ColorTraits enabled type. More... | |
operator bool () const | |
Evaluate in boolean context (not nocolor) More... | |
Color & | operator<= (Color rhs) |
Update Color (assign components which are not Unchanged in rhs ) More... | |
Color & | operator<= (Color::Attr rhs) |
Color & | operator<= (Color::Fg rhs) |
Color & | operator<= (Color::Bg rhs) |
Color & | operator<= (Color::Constant rhs) |
Color | operator< (Color rhs) const |
Return updated color. More... | |
Color | operator< (Color::Attr rhs) const |
Color | operator< (Color::Fg rhs) const |
Color | operator< (Color::Bg rhs) const |
Color | operator< (Color::Constant rhs) const |
Attr | attr () const |
Color & | attr (Attr attr_r) |
Fg | fg () const |
Color & | fg (Fg fg_r) |
Bg | bg () const |
Color & | bg (Bg bg_r) |
UidType | uid () const |
Each color has a unique numeric id. More... | |
const std::string & | str () const |
The colors SGRsequence if do_colors is true . More... | |
std::string | debugstr () const |
The colors SGRsequence human readable. More... | |
Static Public Member Functions | |
static Color | nocolor () |
Leave everything unchanged. More... | |
static Color | fromString (const std::string &colorName) |
static const std::string & | SGRReset () |
ANSI SGR sesquence to reset all attributes. More... | |
Private Member Functions | |
Color (UidType) | |
ctor nocolor, all ::Unchanged, uid 0 More... | |
Static Private Member Functions | |
static std::string & | genSGR (Color color_r) |
Return a colors SGRsequence if do_colors retruns true . More... | |
Private Attributes | |
union ztui::ansi::Color::Comp | _comp |
Related Functions | |
(Note that these are not member functions.) | |
bool | operator== (Color lhs, Color rhs) |
bool | operator!= (Color lhs, Color rhs) |
std::ostream & | operator<< (std::ostream &str, Color obj) |
Various ways to define ansi SGR sequences.
Any color component (Attr, Fg, Bg) may have the value Uchanged
, indicating that this component should remain unchanged when the terminal color is set. To mimic this use operator<<= which updates a color by omitting Unchanged
components. nocolor
using ztui::ansi::Color::UidType = std::uint32_t |
|
strong |
|
strong |
|
strong |
enum ztui::ansi::Color::Constant : std::uint8_t |
Predefined (foregreound) color contants Intentionally not an enum class
, so it can be used as Color::Red
, Color::Default
, etc.
|
inline |
|
inline |
|
inline |
|
inline |
Color constant combined with background (Bg::Default)
|
inline |
Custom ctor from ColorTraits enabled type.
|
inlineprivate |
|
inlinestatic |
|
static |
Returns the Color corresponding to the colorName. If colorName does not match a known string this returns the same as nocolor.
|
inlineexplicit |
|
inlinestatic |
ANSI SGR sesquence to reset all attributes.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinestaticprivate |
|
related |
|
private |