101 DeepSkyBlue3_31 = 31,
102 DeepSkyBlue3_32 = 32,
105 SpringGreen3_35 = 35,
111 SpringGreen3_41 = 41,
112 SpringGreen2_42 = 42,
117 SpringGreen2_47 = 47,
119 MediumSpringGreen = 49,
135 DarkSeaGreen4_65 = 65,
141 DarkSeaGreen4_71 = 71,
150 MediumTurquoise = 80,
167 MediumPurple3_97 = 97,
168 MediumPurple3_98 = 98,
173 LightSlateGrey = 103,
175 LightSlateBlue = 105,
177 DarkOliveGreen3_107 = 107,
179 LightSkyBlue3_109 = 109,
180 LightSkyBlue3_110 = 110,
182 Chartreuse2_112 = 112,
183 DarkOliveGreen3_113 = 113,
184 PaleGreen3_114 = 114,
185 DarkSeaGreen3_115 = 115,
186 DarkSlateGray3 = 116,
189 LightGreen_119 = 119,
190 LightGreen_120 = 120,
191 PaleGreen1_121 = 121,
192 Aquamarine1_122 = 122,
193 DarkSlateGray1 = 123,
196 MediumVioletRed = 126,
198 DarkViolet_128 = 128,
200 DarkOrange3_130 = 130,
205 MediumPurple2_135 = 135,
207 LightSalmon3_137 = 137,
210 MediumPurple2_140 = 140,
216 LightSteelBlue3 = 146,
217 LightSteelBlue = 147,
219 DarkOliveGreen3_149 = 149,
220 DarkSeaGreen3_150 = 150,
221 DarkSeaGreen2_151 = 151,
225 DarkOliveGreen2 = 155,
226 PaleGreen1_156 = 156,
227 DarkSeaGreen2_157 = 157,
228 DarkSeaGreen1_158 = 158,
229 PaleTurquoise1 = 159,
236 DarkOrange3_166 = 166,
241 MediumOrchid1_171 = 171,
243 LightSalmon3_173 = 173,
249 LightGoldenrod3 = 179,
256 LightGoldenrod2_186 = 186,
259 LightSteelBlue1 = 189,
261 DarkOliveGreen1_191 = 191,
262 DarkOliveGreen1_192 = 192,
263 DarkSeaGreen1_193 = 193,
273 IndianRed1_203 = 203,
274 IndianRed1_204 = 204,
277 MediumOrchid1_207 = 207,
281 PaleVioletRed1 = 211,
291 LightGoldenrod2_221 = 221,
292 LightGoldenrod2_222 = 222,
297 LightGoldenrod1 = 227,
343 return ansiColor(
static_cast<int>(color));
485 if(!_enabled)
return *
this;
486 *
this <<
"\033[" << n <<
"A";
496 if(!_enabled)
return *
this;
497 *
this <<
"\033[" << n <<
"B";
507 if(!_enabled)
return *
this;
508 *
this <<
"\033[" << n <<
"C";
518 if(!_enabled)
return *
this;
519 *
this <<
"\033[" << n <<
"D";
530 if(!_enabled)
return *
this;
531 *
this <<
"\033[" << r <<
";" << c <<
"H";
540 if(!_enabled)
return *
this;
550 if(!_enabled)
return *
this;
560 if(!_enabled)
return *
this;
561 *
this <<
"\033[999G";
570 if(!_enabled)
return *
this;
580 if(!_enabled)
return *
this;
590 if(!_enabled)
return *
this;
600 if(!_enabled)
return *
this;
610 if(!_enabled)
return *
this;
620 if(!_enabled)
return *
this;
630 if(!_enabled)
return *
this;
631 *
this <<
"\033[?25h";
640 if(!_enabled)
return *
this;
641 *
this <<
"\033[?25l";
650 if(!_enabled)
return *
this;
661 if(!_enabled)
return *
this;
673 if(!_enabled)
return *
this;
674 *
this <<
"\033[" << startRow <<
";" << endRow <<
"r";
684 if(!_enabled)
return *
this;
685 *
this <<
"\033[" << n <<
"S";
695 if(!_enabled)
return *
this;
696 *
this <<
"\033[" << n <<
"T";
706 if(!_enabled)
return *
this;
707 *
this <<
"\033[" << n <<
"X";
722 if(!_enabled)
return *
this;
723 *
this <<
"\033[38;5;" <<
static_cast<int>(index) <<
"m";
738 if(!_enabled)
return *
this;
739 *
this <<
"\033[48;5;" <<
static_cast<int>(index) <<
"m";
751 if(!_enabled)
return *
this;
752 *
this <<
"\033[38;2;" <<
static_cast<int>(r) <<
";"
753 <<
static_cast<int>(g) <<
";" <<
static_cast<int>(b) <<
"m";
765 if(!_enabled)
return *
this;
766 *
this <<
"\033[48;2;" <<
static_cast<int>(r) <<
";"
767 <<
static_cast<int>(g) <<
";" <<
static_cast<int>(b) <<
"m";
777 if(!_enabled)
return *
this;
778 *
this <<
"\033[" << (enable ?
"9" :
"29") <<
"m";
787 if(!_enabled)
return *
this;
788 *
this <<
"\033[?1049h";
797 if(!_enabled)
return *
this;
798 *
this <<
"\033[?1049l";
ANSI escape code writer backed by an IODevice. Writes ANSI escape sequences and raw text to an IODevi...
Definition ansistream.h:27
static AnsiColor findClosestAnsiColor(const Color &color, int maxIndex=255)
Finds the closest ANSI palette entry for an RGB color.
AnsiStream & operator<<(const String &text)
Writes a String via operator<<.
Definition ansistream.h:431
static Color ansiColor(AnsiColor color)
Returns the RGB color for an AnsiColor palette entry.
Definition ansistream.h:342
AnsiStream & cursorLeft(int n)
Moves the cursor left N columns.
Definition ansistream.h:517
static bool stdoutWindowSize(int &rows, int &cols)
Returns the window size of the current STDOUT device.
AnsiStream & resetForeground()
Resets the foreground to the terminal default.
Definition ansistream.h:609
AnsiStream & cursorUp(int n)
Moves the cursor up N rows.
Definition ansistream.h:484
AnsiStream & write(const char *text)
Writes a C string to the underlying device.
AnsiStream & write(char ch)
Writes a single character to the underlying device.
AnsiStream & setBackground256(uint8_t index)
Sets the background to a 256-color palette index.
Definition ansistream.h:737
AnsiStream & setBackground(AnsiColor color)
Sets the background to an ANSI palette color.
AnsiStream & setForeground(const Color &color, int maxIndex=255)
Sets the foreground to the closest ANSI palette match.
AnsiStream & setBackground(const Color &color, int maxIndex=255)
Sets the background to the closest ANSI palette match.
AnsiStream & setForegroundRGB(uint8_t r, uint8_t g, uint8_t b)
Sets the foreground to a 24-bit RGB color.
Definition ansistream.h:750
AnsiColor
ANSI 256-color palette indices.
Definition ansistream.h:56
@ DarkCyan
Alias for Teal.
Definition ansistream.h:70
@ DarkBlue
Alias for Navy.
Definition ansistream.h:66
@ LightGray
Alias for Silver.
Definition ansistream.h:72
@ DarkGray
Alias for Grey.
Definition ansistream.h:74
@ DarkRed
Alias for Maroon.
Definition ansistream.h:60
@ DarkYellow
Alias for Olive.
Definition ansistream.h:64
@ Cyan
Alias for Aqua.
Definition ansistream.h:82
@ DarkGreen
Alias for Green (system).
Definition ansistream.h:62
@ Magenta
Alias for Fuchsia.
Definition ansistream.h:80
@ DarkMagenta
Alias for Purple (system).
Definition ansistream.h:68
AnsiStream & write(const String &text)
Writes raw text to the underlying device.
AnsiStream & scrollUp(int n)
Causes the scrolling region to scroll up N rows.
Definition ansistream.h:683
AnsiStream & clearScreen()
Clears the screen.
Definition ansistream.h:539
AnsiStream & setCursorPosition(int r, int c)
Sets the absolute cursor position.
Definition ansistream.h:529
AnsiStream & moveToEndOfLine()
Moves the cursor to the end of the current line.
Definition ansistream.h:559
AnsiStream & restoreCursorPosition()
Recalls a saved cursor position.
Definition ansistream.h:660
bool getCursorPosition(IODevice *input, int &row, int &col)
Requests the current cursor position from the terminal.
void setAnsiEnabled(bool val)
Sets the ANSI output enabled. If not enabled, no ANSI codes will be output but non-ANSI content will ...
Definition ansistream.h:386
AnsiStream & moveToStartOfLine()
Moves the cursor to the start of the current line.
Definition ansistream.h:549
AnsiStream & enableScrollingRegion(int startRow, int endRow)
Enables a region of the screen to scroll.
Definition ansistream.h:672
TextStyle
ANSI text styles.
Definition ansistream.h:32
@ Inverted
Swapped foreground and background colors.
Definition ansistream.h:38
@ Dim
Faint or decreased intensity.
Definition ansistream.h:34
@ Italic
Italic text.
Definition ansistream.h:35
@ Bold
Bold or increased intensity.
Definition ansistream.h:33
@ Underlined
Underlined text.
Definition ansistream.h:36
@ Hidden
Hidden (invisible) text.
Definition ansistream.h:39
@ Blink
Blinking text.
Definition ansistream.h:37
IODevice * device() const
Returns the underlying IODevice.
Definition ansistream.h:395
AnsiStream & eraseCharacters(int n)
Erases N characters at cursor.
Definition ansistream.h:705
AnsiStream & clearLine()
Clears the current line.
Definition ansistream.h:569
AnsiStream & cursorDown(int n)
Moves the cursor down N rows.
Definition ansistream.h:495
AnsiStream & clearLineAfterCursor()
Clears between the cursor and the end of the current line.
Definition ansistream.h:589
AnsiStream & useMainScreenBuffer()
Terminal should switch to main screen buffer.
Definition ansistream.h:796
AnsiStream & saveCursorPosition()
Saves the cursor position for later recall.
Definition ansistream.h:649
AnsiStream & cursorRight(int n)
Moves the cursor right N columns.
Definition ansistream.h:506
AnsiStream & scrollDown(int n)
Causes the scrolling region to scroll down N rows.
Definition ansistream.h:694
AnsiStream & setForeground(AnsiColor color)
Sets the foreground to an ANSI palette color.
AnsiStream & setStrikethrough(bool enable)
Enables strike-through mode if supported.
Definition ansistream.h:776
void flush()
Flushes the underlying device.
AnsiStream & useAlternateScreenBuffer()
Terminal should switch to an alternate buffer.
Definition ansistream.h:786
AnsiStream & hideCursor()
Makes the cursor invisible.
Definition ansistream.h:639
AnsiStream & operator<<(int val)
Writes an integer via operator<<.
Definition ansistream.h:437
AnsiStream & write(int val)
Writes an integer to the underlying device.
AnsiStream & reset()
Resets the terminal to default configuration.
Definition ansistream.h:599
AnsiStream & resetBackground()
Resets the background to the terminal default.
Definition ansistream.h:619
AnsiStream & setBackgroundRGB(uint8_t r, uint8_t g, uint8_t b)
Sets the background to a 24-bit RGB color.
Definition ansistream.h:764
static bool stdoutSupportsANSI()
Returns true if the current STDOUT can support ANSI signaling.
AnsiStream & operator<<(const char *text)
Writes a C string via operator<<.
Definition ansistream.h:433
static Color ansiColor(int index)
Returns the RGB color for a 256-color palette entry.
AnsiStream(IODevice *device)
Constructs an AnsiStream writing to the given device.
Definition ansistream.h:378
AnsiStream & setForeground256(uint8_t index)
Sets the foreground to a 256-color palette index.
Definition ansistream.h:721
AnsiStream & operator<<(char ch)
Writes a single character via operator<<.
Definition ansistream.h:435
AnsiStream & clearLineBeforeCursor()
Clears between the cursor and the start of the current line.
Definition ansistream.h:579
AnsiStream & showCursor()
Makes the cursor visible.
Definition ansistream.h:629
General-purpose RGBA color.
Definition color.h:24
Abstract base class for all I/O devices.
Definition iodevice.h:29
Encoding-aware string class with copy-on-write semantics.
Definition string.h:35
#define PROMEKI_NAMESPACE_BEGIN
Starts a promeki namespace block.
Definition namespace.h:14
#define PROMEKI_NAMESPACE_END
Ends a promeki namespace block.
Definition namespace.h:19