Color Your Output in Unix using C++!!
http://ascii-table.com/ansi-escape-sequences.php
Escape Sequence Color Header.h (see src folder)
2015/02/09 16:13 (~3h)
Uduse
BOLD, UNDERSCORE, BLINK, REVERSE_VIDEO, CONCEALED
BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE
General Format, include value you want in
COLOR_$Text Attribute$
COLOR_$Foreground Color$$Background Color$
COLOR
e.g.
COLOR_BOLD
COLOR_BLUE_NORMAL // Leave Text Attribute Blank if no TextAttribute appied
COLOR_UNDERSCORE_YELLOW_RED
COLOR_NORMAL
Just use to stream the color you want before outputting text and use again to set the color to normal after outputting text.
cout << COLOR_BLUE_BLACK << "TEXT" << COLOR_NORMAL << endl; cout << COLOR_BOLD_YELLOW_CYAN << "TEXT" << COLOR_NORMAL << endl;
Create a block of Bold text
cout << COLOR_BOLD;
cout << COLOR_RED_CYAN << "COLOR_RED_CYAN";
cout << COLOR_WHITE_MAGENTA << "COLOR_WHITE_MAGENTA";
cout << COLOR_CYAN_YELLOW << "COLOR_CYAN_YELLOW";
cout << COLOR_NORMAL;
Create a block of Red text
cout << COLOR_RED_NORMAL;
cout << COLOR_BOLD << "COLOR_BOLD";
cout << COLOR_UNDERSCORE << "COLOR_UNDERSCORE";
cout << COLOR_NORMAL;
Copyright (c) 2015, Uduse - Aedi Wang, All rights reserved. This project is licensed under The BSD 2-Clause License, see LICENSE.md for details