Skip to content

Latest commit

 

History

History
124 lines (89 loc) · 2.12 KB

README.md

File metadata and controls

124 lines (89 loc) · 2.12 KB

CircleCI

Splash - A C++ library for adding a splash of color

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.

Usage

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>

Examples

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;

Complex Formatting

Splash provides the splash::modifier class for more complex formatting.

Example

#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;

Project setup

Dependencies

  • Python >=3.5

Bootstrap

python3 bootstrap.py

Usage

To generate Makefile:

mkdir build/
cd build/
cmake ..

To build library:

make
ls -l lib/

To run tests:

make test

License

This project is licensed under the MIT license. A copy of this license is provided in this repository.