https://github.com/tomsik68/ansi_colors
Single-header macro-based library for using terminal color codes in C/C++
https://github.com/tomsik68/ansi_colors
c colors colors-codes console cpp terminal
Last synced: 10 months ago
JSON representation
Single-header macro-based library for using terminal color codes in C/C++
- Host: GitHub
- URL: https://github.com/tomsik68/ansi_colors
- Owner: tomsik68
- License: mit
- Created: 2020-01-11T14:10:54.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-01-11T14:18:19.000Z (over 6 years ago)
- Last Synced: 2025-04-09T22:58:26.874Z (about 1 year ago)
- Topics: c, colors, colors-codes, console, cpp, terminal
- Language: C
- Homepage:
- Size: 2.93 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ansi_colors
Single-header macro-based library for terminal color codes
## Screenshot
This is a showcase of all supported formatting at the moment (the colors may look different depending on your terminal configuration):

## Usage
Copy the header file somewhere in your project. Then, you can include it whenever needed.
```c
#include "ansi_colors.h"
```
The color codes can then be used with `puts`, `printf` or really any I/O function that outputs to an ANSI terminal. For example:
```c
#include
#include "ansi_colors.h"
int main(int argc, char** argv) {
printf("Hello world! " BOLD " This text is written in bold!" RESET " this is not!" );
return 0;
}
```