Β«The best colour in the whole world is the one that looks good on you.Β»
β Coco Chanel
colourista is the library that provides a convenient interface for printing
colourful messages to the terminal. It 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 inIOwithText).
The library also provides a set of different pure and impure helpers for the colouring and emphasis.
colourista is compatible with the latest GHC compiler versions starting from 8.4.
In order to start using colourista in your project, you will need to set it up with the three easy steps:
-
Add the dependency on
colouristain your project's.cabalfile. For this, you should modify thebuild-dependssection by adding the name of this library. After the adjustment, this section could look like this:build-depends: colourista ^>= LATEST_VERSION , ...
-
In the module where you wish to use the colourful output with
colourista, you should add the import:import Colourista (...)
-
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!"
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:
extra-deps:
- colourista-0.1.0.0
- ...Then you can add it as a dependency in your package.yaml file as usual:
library:
dependencies:
- colouristaGreat!
Icons made by Freepik from www.flaticon.com is licensed by CC 3.0 BY.

