Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jakeroggenbuck/termcolor-c
Simple color printing in C
https://github.com/jakeroggenbuck/termcolor-c
Last synced: 5 days ago
JSON representation
Simple color printing in C
- Host: GitHub
- URL: https://github.com/jakeroggenbuck/termcolor-c
- Owner: JakeRoggenbuck
- Created: 2022-04-11T04:15:04.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-21T00:04:32.000Z (5 months ago)
- Last Synced: 2024-06-21T19:15:05.236Z (5 months ago)
- Language: C
- Homepage:
- Size: 27.3 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# termcolor-c
Simple color printing in C[![Compile](https://img.shields.io/github/actions/workflow/status/jakeroggenbuck/termcolor-c/c-cpp.yml?branch=main&style=for-the-badge)](https://github.com/JakeRoggenbuck/termcolor-c/actions)
![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/jakeroggenbuck/termcolor-c?style=for-the-badge)# Example
```c
#include "termcolor.h"
#includeint main() {
cprint("Passed\n", FG_GREEN);
cprint("Failed\n", FG_RED);char *msg = "Hello!!";
char *new;
color(msg, new, FG_BLUE);
printf("%s\n", new);return 0;
}
```![image](https://user-images.githubusercontent.com/35516367/175891993-edce1459-de1a-4232-814c-c4c4cc095729.png)
## Quick start
#### Add termcolor as a dependency
```
git submodule add [email protected]:JakeRoggenbuck/termcolor-c.git
```#### For CMakeLists.txt (if you are using that)
```diff
-add_executable(project_name ${SOURCES})
+add_executable(project_name ${SOURCES} termcolor-c/src/termcolor.c)
+include_directories(${PROJECT_SOURCE_DIR}/termcolor-c/src)
```#### Add the color printing code
```c
#include "termcolor.h"
#includeint main() {
cprint("Hello World!\n", FG_GREEN);
return 0;
}
```## Why
I made this just in case I start writing a bunch of CLI stuff in C in the next few months before college, and during college as well.
So far, here are my favorites:
- [diri-c](https://github.com/jakeroggenbuck/diri-c)
- [cosmic-ray-detector](https://github.com/JakeRoggenbuck/cosmic-ray-detector)