https://github.com/uduse/escape-sequence-color-header
Color Your Output in Unix using C++
https://github.com/uduse/escape-sequence-color-header
Last synced: 20 days ago
JSON representation
Color Your Output in Unix using C++
- Host: GitHub
- URL: https://github.com/uduse/escape-sequence-color-header
- Owner: uduse
- License: bsd-2-clause
- Created: 2015-02-09T22:28:52.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2015-09-02T19:33:07.000Z (over 9 years ago)
- Last Synced: 2025-04-10T02:16:55.602Z (23 days ago)
- Language: C
- Homepage:
- Size: 1 MB
- Stars: 7
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Escape-Sequence-Color-Header
Color Your Output in Unix using C++!!
## Principle
http://ascii-table.com/ansi-escape-sequences.php
## File:
**Escape Sequence Color Header.h (see src folder)**
## Date:
2015/02/09 16:13 (~3h)
## Author:
Uduse
## Text Attribute Options:
BOLD, UNDERSCORE, BLINK, REVERSE_VIDEO, CONCEALED
## Color Options:
BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE
## Format:General Format, include value you want in $variable$
COLOR_$Text Attribute$
COLOR_$Foreground Color$_$Background Color$
COLOR_$Text Attribute$_$Foreground Color$_$Background Color$
COLOR_NORMAL // To set color to defaulte.g.
```cpp
COLOR_BOLD
COLOR_BLUE_NORMAL // Leave Text Attribute Blank if no TextAttribute appied
COLOR_UNDERSCORE_YELLOW_RED
COLOR_NORMAL
```
## Usage:
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;## More Examples
Create a block of **Bold** text
```cpp
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
```cpp
cout << COLOR_RED_NORMAL;
cout << COLOR_BOLD << "COLOR_BOLD";
cout << COLOR_UNDERSCORE << "COLOR_UNDERSCORE";
cout << COLOR_NORMAL;
```
## License
Copyright (c) 2015, Uduse - Aedi Wang, All rights reserved.
This project is licensed under The BSD 2-Clause License, see LICENSE.md for details