ColoredPrintf is a very simple library that provide a printf-like function with color support. A first version of the library is available on NuGet with it’s source code on my Github.

The syntax to use for color is $foreground;background[text] with the color names being the same as in the ConsoleColor enumeration.

The main entry points of the library are the colorprintf and colorprintfn functions that have the same signature as printf and printfn (It uses my MasterOfFoo library for that).


colorprintfn "Hello $red[world]."
colorprintfn "Hello $green[%s]." "user"
colorprintfn "$white[Progress]: $yellow[%.2f%%] (Eta $yellow[%i] minutes)" 42.33 5
colorprintfn "$white;blue[%s ]$black;white[%s ]$white;red[%s]" "La vie" "est" "belle"