- Notifications
You must be signed in to change notification settings - Fork17
️🌈 Convenient interface for printing colourful messages
License
kowainik/colourista
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
«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 printingcolourful messages to the terminal. It is based onansi-terminal
, however,in contradistinction to this Haskell library,colourista
is a high-levelwrapper focused on easily achieved output modification without low-level setup.
The two main functions thatcolourista
provides are:
formatWith
— the function that formats pure output by applying providedformatting codes. It works with polymorphic strings.formattedMessage
— the function that outputs the formatted output directlyinto the terminal (working inIO
withText
).
The library also provides a set of different pure and impure helpers for thecolouring and emphasis.
colourista
is compatible with the latest GHC compiler versions starting from8.4
.
In order to start usingcolourista
in your project, you will need to set it up with the three easy steps:
Add the dependency on
colourista
in your project's.cabal
file. For this,you should modify thebuild-depends
section by adding the name of thislibrary. 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:importColourista (...)
Now you can use the functions from the library. For example:
importqualifiedData.TextasTextmain::IO()main= successMessage$Text.pack"All set up!"
Ifcolourista
is not available on your current Stackage resolver yet, fear not! You can still useit from Hackage by adding the following to theextra-deps
section of yourstack.yaml
file:
extra-deps: -colourista-0.1.0.0 -...
Then you can add it as a dependency in yourpackage.yaml
file as usual:
library:dependencies: -colourista
Great!
Icons made byFreepik fromwww.flaticon.com is licensed byCC 3.0 BY.
About
️🌈 Convenient interface for printing colourful messages