Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

‎️‍🌈 Convenient interface for printing colourful messages

License

NotificationsYou must be signed in to change notification settings

kowainik/colourista

Repository files navigation

logo

GitHub CIHackageStackage LtsStackage NightlyMPL-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 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.

Interface

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.

Example

output

How to use

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:

  1. Add the dependency oncolourista 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             ,...
  2. In the module where you wish to use the colourful output withcolourista,you should add the import:

    importColourista (...)
  3. Now you can use the functions from the library. For example:

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

Usage with Stack

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.yamlfile:

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!

Acknowledgement

Icons made byFreepik fromwww.flaticon.com is licensed byCC 3.0 BY.


[8]ページ先頭

©2009-2025 Movatter.jp