Module

Ansi.Output

Package
purescript-ansi
Repository
hdgarrood/purescript-ansi

Convenience functions to simplify outputting ANSI escape codes to terminals.

#withGraphics Source

withGraphics :: NonEmptyList GraphicsParam -> String -> String

Wrap the given text in escape codes corresponding to the given parameters. For example:

Console.log $ withGraphics (bold <> underline <> foreground BrightRed) "hello world"

would print "hello world" to the terminal, bold, underlined, and in bright red, and then reset (so that further logging to the console uses the normal color and style).

This function simply wraps the given text in an escape code and a reset code, so that it is a little more comfortable to use than the functions in Ansi.Codes.