Monthly Downloads: 91
Programming language: Haskell
License: Mozilla Public License 2.0
Tags: Terminal     Ansi    
Latest version: v0.1.0.0
Add another 'ANSI' Package




GitHub CI Hackage Stackage Lts Stackage Nightly [MPL-2.0 license](LICENSE)

Β«The best colour in the whole world is the one that looks good on you.Β»

β€” Coco Chanel

colourista is the library that provides a simple and convenient interface for printing colourful messages to the terminal. Additionally, colourista allows to easily control enabling and disabling of colours.

The library is based on ansi-terminal, however, in contradistinction to this Haskell library, colourista is a high-level wrapper focused on easily achieved output modification without low-level setup.


The two main functions that colourista provides are:

  • formatWith β€” the function that formats pure output by applying provided formatting codes. It works with polymorphic strings.
  • formattedMessage β€” the function that outputs the formatted output directly into the terminal (working in IO with Text).

The library also provides a set of different pure and impure helpers for the colouring and emphasis.


Simple output example:


Example of disabling colouring. The colour mode controlling is based on the Implicit Parameters GHC feature.

Colour mode

How to use

colourista is compatible with the latest GHC compiler versions starting from 8.2.2.

In order to start using colourista in your project, you will need to set it up with the three easy steps:

  1. Add the dependency on colorista in your project's .cabal file. For this, you should modify the build-depends section by adding the name of this library. After the adjustment, this section could look like this:
   build-depends: base ^>= 4.14
                , colourista ^>= 0.1
                , ...
  1. In the module where you wish to use the colourful output with colourista, you should add the import:
   import Colourista (...)
  1. Now you can use the functions from the library. For example:
   import qualified Data.Text as Text

   main :: IO ()
   main = successMessage $ Text.pack "All set up!"

Usage with Stack

If colourista is not available on your current Stackage resolver yet, fear not! You can still use it from Hackage by adding the following to the extra-deps section of your stack.yaml file:

  - colourista-
  - ...

Then you can add it as a dependency in your package.yaml file as usual:

    - colourista



Icons made by Freepik from www.flaticon.com is licensed by CC 3.0 BY.

*Note that all licence references and agreements mentioned in the colourista README section above are relevant to that project's source code only.