Splash is a C++ library for wrapping text with ANSI color codes for the purpose of adding just a little bit of color to your logs.
Splash comes with a range of helper functions in the splash namespace to
quickly add some color to your logs. Each function takes a std::string and
returns a std::string all colorified.
These helper functions are imported using
#include <splash/splash.h>Bolding text
std::cout << splash::bold("Hello world!") << std::endl;Underlining text
std::cout << splash::underline("Hello world!") << std::endl;Black text
std::cout << splash::black("Hello world!") << std::endl;Red text
std::cout << splash::red("Hello world!") << std::endl;Green text
std::cout << splash::green("Hello world!") << std::endl;Yellow text
std::cout << splash::yellow("Hello world!") << std::endl;Blue text
std::cout << splash::blue("Hello world!") << std::endl;Magenta text
std::cout << splash::magenta("Hello world!") << std::endl;Cyan text
std::cout << splash::cyan("Hello world!") << std::endl;White text
std::cout << splash::white("Hello world!") << std::endl;Splash provides the splash::modifier class for more complex
formatting.
#include <splash/modifier.h>
splash::modifier formatter;
formatter.addAttribute(splash::attribute::FG_RED);
formatter.addAttribute(splash::attribute::BOLD);
std::cout << formatter.wrap("Hello world!") << std::endl;- Python >=3.5
python3 bootstrap.pyTo generate Makefile:
mkdir build/
cd build/
cmake ..To build library:
make
ls -l lib/To run tests:
make testThis project is licensed under the MIT license. A copy of this license is provided in this repository.