ColrC  0.3.7
An easy to use C library for linux terminal colors/escape-codes.
#include "colr.h"
int main(void) {
Colr() is for styling one piece of text.
When combined with the colr_cat() macro it allows you to seperate colors/styles.
char* colorized = colr_cat(
Colr("America ", fore(RED)),
Colr("the ", fore(WHITE)),
Colr("beautiful", fore(BLUE)),
All of the Colr, fore, back, and style resources were free'd by `colr`.
You are responsible for the text and the resulting colorized string.
if (!colorized) return 1;
printf("%s", colorized);
There are three justification macros that make it easy to create
ColorText's with center, left, or right-justified text.
char* just = colr_cat(
Colr_center("This is centered.", 80, fore("lightblue")),
Colr_ljust("This is on the left.", 38, fore(ext_hex("ff2525"))),
Colr_rjust("This is on the right.", 38, fore(ext_rgb(255, 53, 125)))
if (!colorized) return 1;
printf("%s\n", just);
If you don't need several Colr() calls, there is a shortcut for safely
creating colorized text using colr().
char* fast = colr(
"Hello from ColrC.",
if (!fast) return 1;
printf("%s\n", fast);