A single-header C library for printing colored text to the console. It supports both Windows and Unix-like systems.
Include the printfcolor.h
header file in your C project:
#include "printfcolor.h"
#include "printfcolor.h"
int main()
{
printfc_fg(BLUE, "Blue text\n");
printfc_fg(MAGENTA, "Magenta text\n\n");
printfc_bg(GREEN, "Green background\n");
printfc_bg(RED, "Red background\n\n");
printfc(WHITE, BLUE, "White on blue\n");
printfc(MAGENTA, CYAN, "Magenta on cyan\n");
}
Output:
- Windows: Uses Windows Console API.
- Unix-like Systems: Uses ANSI escape codes.
- Invalid Color Code: Prints an error message and returns
-1
. - Console Info Retrieval Failure: Prints an error message and returns
-1
.
This project is licensed under the MIT License - see the LICENSE file for details