ANSI text formatting escape sequences in C
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
# cansic - ANSI text formatting escape sequences in C
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
`#include` the `.h` file and use pre-defined constants
|
|
|
|
|
|
|
|
|
|
|
|
## Example
|
|
|
|
|
|
|
|
```c
|
|
|
|
#include "cansic.h"
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
int main(void) {
|
|
|
|
const char* text = "This is a text";
|
|
|
|
printf("%s%s%s\n", CANSIC_BOLD, text, CANSIC_END);
|
|
|
|
printf("%s%s%s\n", CANSIC_ITALIC, text, CANSIC_END);
|
|
|
|
printf("%s%s%s\n", CANSIC_UNDERLINE, text, CANSIC_END);
|
|
|
|
printf("%s%s%s\n", CANSIC_RAPIDBLINK, text, CANSIC_END);
|
|
|
|
printf("%s\n", CANSIC_BOLD CANSIC_UNDERLINE CANSIC_SLOWBLINK "String literals are more elegant" CANSIC_END);
|
|
|
|
|
|
|
|
printf("%s%s%s\n", CANSIC_FG_RGB(90, 50, 200), text, CANSIC_END);
|
|
|
|
printf("%s%s%s\n", CANSIC_BG_RGB(255, 55, 55), text, CANSIC_END);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
It is your responsibility to check whether the interface supports this ANSI format or not
|
|
|
|
|
|
|
|
## License
|
|
|
|
|
|
|
|
MIT
|