/formicine

A C++ library for doing things with ANSI.

Primary LanguageC++GNU Lesser General Public License v3.0LGPL-3.0

Formicine

A simple C++ library that wraps ostreams for use with ANSI escapes.

Example

Code
#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";
}
Output

Normal text
Bold text
Green text
Underlined text, italic+underlined text and just italic text.