37 #include <OpenMS/config.h>
156 static bool isTTY(
const std::ostream& stream);
163 static void colorStream_(std::ostream& stream,
const char* ANSI_command);
174 bool undo_all_ =
true;
178 bool undos_only =
false;
208 inline static const constexpr std::array<ColorWithUndo_, 9> colors_ {
219 const char* color_undo_all_ =
"\033[0m";
Color and style the fonts shown on cout/cerr (or other streams)
Definition: Colorizer.h:97
std::stringstream input_
Definition: Colorizer.h:223
Colorizer()=delete
Constructor (deleted)
const char * enable
ANSI code to activate the color/style.
Definition: Colorizer.h:201
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:202
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:182
~Colorizer()=default
Destructor.
Colorizer & operator()()
Definition: Colorizer.h:121
Colorizer & undoAll()
prepare this colorizer to reset the console to its default colors/style.
void setInternalChars_(const std::string &data)
Definition: Colorizer.h:190
Colorizer & operator()(T s)
Definition: Colorizer.h:134
const ConsoleColor color_
color of the stream (const; set in C'tor)
Definition: Colorizer.h:166
Definition: Colorizer.h:200
Class for writing data which spans multiple lines with an indentation for each line (all except the f...
Definition: IndentedStream.h:62
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:48
std::ostream & operator<<(std::ostream &os, const AccurateMassSearchResult &amsr)
ConsoleColor
Text colors/styles supported by Colorizer.
Definition: Colorizer.h:47
@ INVERT
invert foreground and background color (inverting twice stays inverted)
@ BRIGHT
keeps the foreground color, but makes it brighter