Skip to content

eldesh/colored_printf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ColoredPrintf

output colorized strings to your terminal like printf(3) family.

need terminal pick out ANSI escape sequence. [1]

just run make in top level directory of this library, then you will get lib/libcolored-printf.a.

make sample would build the sample programs colorchart and show_ppm .

colorchart
display color chart.
show_ppm
display PPM image.

see sample/colorchart.c :)

.. c:function:: int fprintf_256colored(color256_t fr_color, color256_t bk_color, FILE * fp, char const * format, ...)

       output fore&back ground colored string


for example, you can accentuate error messages like below:

color256_t const white = color256_of_gray(23);
color256_t const   red = color256_of_rgb(5,0,0);
fprintf_256colored(white, red, stdout
                  , "[ERROR] no such file or directory (%s)"
                  , path_to_dir);

then, users would see the red-colored error message.


[1]http://en.wikipedia.org/wiki/ANSI_escape_code

About

extended printf(3) to output colored strings to terminals

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors