11 #include <OpenMS/config.h>
130 static bool isTTY(
const std::ostream& stream);
137 static void colorStream_(std::ostream& stream,
const char* ANSI_command);
148 bool undo_all_ =
true;
152 bool undos_only =
false;
182 inline static const constexpr std::array<ColorWithUndo_, 9> colors_ {
193 const char* color_undo_all_ =
"\033[0m";
Color and style the fonts shown on cout/cerr (or other streams)
Definition: Colorizer.h:71
std::stringstream input_
Definition: Colorizer.h:197
Colorizer()=delete
Constructor (deleted)
const char * enable
ANSI code to activate the color/style.
Definition: Colorizer.h:175
friend std::ostream & operator<<(std::ostream &o_stream, Colorizer &col)
stream insertion, e.g. std::cout << red() << "this is red" << red.undo();
static bool isTTY(const std::ostream &stream)
const char * disable
ANSO code to undo the color/style.
Definition: Colorizer.h:176
static void colorStream_(std::ostream &stream, const char *ANSI_command)
color the stream using the given color
Colorizer(const ConsoleColor color)
Constructor.
Colorizer(const Colorizer &rhs)=delete
Copy constructor (deleted)
void outputToStream_(std::ostream &o_stream)
write the content of input_ to the stream
const std::stringstream & getInternalChars_() const
Definition: Colorizer.h:156
~Colorizer()=default
Destructor.
Colorizer & operator()()
Definition: Colorizer.h:95
Colorizer & undoAll()
prepare this colorizer to reset the console to its default colors/style.
void setInternalChars_(const std::string &data)
Definition: Colorizer.h:164
Colorizer & operator()(T s)
Definition: Colorizer.h:108
const ConsoleColor color_
color of the stream (const; set in C'tor)
Definition: Colorizer.h:140
Definition: Colorizer.h:174
Class for writing data which spans multiple lines with an indentation for each line (all except the f...
Definition: IndentedStream.h:36
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22
std::ostream & operator<<(std::ostream &os, const AccurateMassSearchResult &amsr)
ConsoleColor
Text colors/styles supported by Colorizer.
Definition: Colorizer.h:21
@ INVERT
invert foreground and background color (inverting twice stays inverted)
@ BRIGHT
keeps the foreground color, but makes it brighter