1 #ifndef IOUTILITIES_ANSIESCAPECODES
2 #define IOUTILITIES_ANSIESCAPECODES
5 #include "../misc/traits.h"
12 namespace EscapeCodes {
37 stream << '\e' << '[' << static_cast<char>(displayAttribute) <<
'm';
45 stream << '\e' << '[' << static_cast<char>(displayAttribute) <<
';' <<
static_cast<char>(context) <<
static_cast<char>(
color) <<
'm';
53 <<
static_cast<char>(foregroundColor) <<
';' <<
static_cast<char>(
ColorContext::Background) <<
static_cast<char>(backgroundColor)
65 inline void setCursor(std::ostream &stream,
unsigned int row = 0,
unsigned int col = 0)
68 stream <<
'\e' <<
'[' << row <<
';' << col <<
'H';
75 stream << '\e' << '[' << cells << static_cast<char>(direction);
115 return std::make_tuple(foreground, background, displayAttribute);
120 return std::make_tuple(foreground, context, displayAttribute);
123 template <
typename TupleType,
125 std::is_same<TupleType, std::tuple<Color, ColorContext, TextAttribute>>> * =
nullptr>
126 inline std::ostream &
operator<<(std::ostream &stream, TupleType displayAttribute)
128 setStyle(stream, std::get<0>(displayAttribute), std::get<1>(displayAttribute), std::get<2>(displayAttribute));
159 #endif // IOUTILITIES_ANSIESCAPECODES