[Haskell-cafe] [ANNOUNCE] rainbow - print colored text on UNIX-like systems

Omari Norman omari at smileystation.com
Sun Jun 9 20:10:16 CEST 2013


Hi all,

rainbow is a simple package to help you print colored text on UNIX-like
systems. It's different from packages like terminfo (upon which it is
based) and ansi-terminal in two ways. First, rainbow assumes you print text
one "chunk" at a time. The properties of the terminal are reset with every
chunk. That way you do not need to remember what the terminal's properties
were before you print a new chunk. One chunk does not affect the next
chunk. It's a state-free model that fits in well with functional
programming.

Second, rainbow makes it easy to use both 8- and 256-color terminals.

Some sample things you can do in ghci:

:set -XOverloadedStrings
:m +System.Console.Rainbow
putChunkLn $ "Hello bold green world!" <> f_green <> bold
putChunkLn $ "Red on 8-color, pink on 256-color" <> f_red <> c256_f_201
mapM_ putChunk ["green on blue" <> f_green <> b_blue, " ", "blue on green"
<> f_blue <> b_green, "\n"]

So, add some color to things:

http://hackage.haskell.org/package/rainbow
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130609/fa0ed430/attachment.htm>


More information about the Haskell-Cafe mailing list