A simple C++ library that wraps ostreams for use with ANSI escapes.
#include <iostream>
#include "ansi.h"
int main(int, char **) {
ansi::ansistream as(std::cout, std::cerr);
as << "Normal text\n";
as << ansi::bold << "Bold text" << ansi::reset << "\n";
as << fg(ansi::green) << "Green text" << ansi::reset << "\n";
as << ansi::underline << "Underlined text,"
<< ansi::italic << " italic+underlined text"
>> ansi::underline << " and just italic text."
<< ansi::reset << "\n";
}
Normal text
Bold text
Green text
Underlined text, italic+underlined text and just italic text.