Skip to content

Repository files navigation

Colored Printf

color drops Logo

Github Actions StatusNuget Package

This library provide a replacement to F# printf function with color support.

The syntax to set the color inside the string is $foreground;background[text] where both foreground and background are optional.

The supported colors are the one from the System.ConsoleColor enum.

Examples

// Change the color of part of a string
colorprintfn "$red[Hello] $white;red[world]."// Use sprintf syntax
colorprintfn "Hello $green[%s]: %s""user""Welcome to color!"
colorprintfn "$white[Progress]: $yellow[%.2f%%] (Eta $yellow[%i] minutes)"42.335// Use interpolated stringsletlife="La vie"letis_="est"
colorprintfn $"""$white;blue[%s{life} ]$black;white[{is_} ]$white;red[{"belle"}]"""// Specify the colors from variablesletlogColor= ConsoleColor.Yellow
colorprintfn "result: $%A[Hello world]" logColor
colorprintfn $"result: ${logColor}[Hello world]"

Displays :

Demo

Thanks

About

F# printf functions but with colors !

Topics

Resources

Stars

47 stars

Watchers

2 watching

Forks

Releases

Used by

Contributors

Languages