colorize
colorize copied to clipboard
A Library to colorize program output to terminals
String-Colorization Library for Terminal Output
Basic colorize function call
std::string const& colorized_string =
color::rize( ORIGINAL_STRING,
A_FOREGROUND_COLOR_STRING,
A_BACKGROUND_COLOR_STRING );
Example Usage:
//example.cpp
std::string message{"I am a Banana!"};
// Output message with
// foreground color -- Yellow
// background color -- Green
std::cout << color::rize( message, "Yellow", "Green" )
<< std::endl;
Compilation command:
g++ -o example example.cpp -std=c++17
Availiable colors:
DefaultBlackRedGreenYellowBlueMagentaCyanLight GreyDark GreyLight RedLight GreenLight YellowLight BlueLight MagentaLight CyanWhite
More Example
with function
std::string const& colorized_string =
color::rize( ORIGINAL_STRING,
A_FOREGROUND_COLOR_STRING,
A_BACKGROUND_COLOR_STRING,
A_ATTRIBUTE_STRING );
where the last parameter A_ATTRIBUTE_STRING can be
DefaultBoldDimUnderlinedBlinkReverseHidden
and an some of the examples

with Python (3.8)
from colorize import colorize
colorize( ORIGINAL_STRING, A_FOREGROUND_COLOR_STRING, A_BACKGROUND_COLOR_STRING, A_ATTRIBUTE_STRING );