A single C++11 header-only file for adding colors to your std::cout function. This project has been inspired by https://github.com/agauniyal/rang and agauniyal/rang#103
#define WARNING_COLOR termcolor::color(termcolor::style::bold, termcolor::fg::red)
#define ERROR_COLOR termcolor::color(termcolor::style::bold, termcolor::fg::green)
#define DEFAULT_COLOR termcolor::color()
termcolor::enable();
std::cout << WARNING_COLOR << "- Warning\n"
<< ERROR_COLOR << "+ Error"
<< DEFAULT_COLOR << std::endl;
termcolor::disable();
std::cout << WARNING_COLOR << "- Warning\n"
<< ERROR_COLOR << "+ Error"
<< DEFAULT_COLOR << std::endl;
Will produce something like this in your console:
- Warning
+ Error
- Warning
+ Error
If you want to ignore color requests call termcolor::disable();
To enable color back: termcolor::enable();
. For more examples see the unit-test file.