MPL-2.0 licensed by Veronika Romashkina, Dmitrii Kovanikov
Maintained by Kowainik
This version can be pinned in stack with:colourista-0.1.0.2@sha256:5ec83f3ff93aa46e54d2a35ad648547ca6b563442e6e57536a664fd2a068088d,3364

Module documentation for 0.1.0.2

colourista

logo

GitHub CI Hackage Stackage Lts Stackage Nightly MPL-2.0 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 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.

Interface

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.

Example

output

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 colourista 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: colourista ^>= LATEST_VERSION
                 , ...
    
  2. In the module where you wish to use the colourful output with colourista, you should add the import:

    import Colourista (...)
    
  3. 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:

extra-deps:
  - colourista-0.1.0.0
  - ...

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

library:
  dependencies:
    - colourista

Great!

Acknowledgement

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

Changes

Changelog

colourista uses PVP Versioning. The changelog is available on GitHub.

0.1.0.2 – Oct 5, 2022

  • #95: Support GHC-9.2.
  • Support GHC-9.4.
  • Upgrade text to version 2.0.
  • Upgrade hspec version.

🐰🥚 0.1.0.1 — Apr 5, 2021

  • #55: Support GHC-9.0.

0.1.0.0 — May 2, 2020 🌈

  • #22: Support GHC-8.10.
  • #27: Add unicode indicators to *Message functions.
  • #17: Add indent formatting function.
  • #7: Add underline, doubleUnderline, noUnderline formatting functions.
  • #28: Add Colourista.Short with short aliases for bold, italic and underline.

0.0.0.0 — Feb 16, 2020 🌈

  • Initially created.