https://github.com/kowainik/colourista
βοΈβπ Convenient interface for printing colourful messages
https://github.com/kowainik/colourista
ansi colours hacktoberfest haskell haskell-library pretty-printing terminal
Last synced: 5 months ago
JSON representation
βοΈβπ Convenient interface for printing colourful messages
- Host: GitHub
- URL: https://github.com/kowainik/colourista
- Owner: kowainik
- License: mpl-2.0
- Created: 2020-02-12T19:08:28.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2025-05-09T14:08:59.000Z (5 months ago)
- Last Synced: 2025-05-10T07:42:40.876Z (5 months ago)
- Topics: ansi, colours, hacktoberfest, haskell, haskell-library, pretty-printing, terminal
- Language: Haskell
- Homepage: https://kowainik.github.io/projects/colourista
- Size: 79.1 KB
- Stars: 68
- Watchers: 5
- Forks: 17
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# colourista

[](https://github.com/kowainik/colourista/actions)
[](https://hackage.haskell.org/package/colourista)
[](http://stackage.org/lts/package/colourista)
[](http://stackage.org/nightly/package/colourista)
[](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`](https://hackage.haskell.org/package/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

## How to use
`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:
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:```haskell
build-depends: colourista ^>= LATEST_VERSION
, ...
```
2. In the module where you wish to use the colourful output with `colourista`,
you should add the import:```haskell
import Colourista (...)
```
3. Now you can use the functions from the library. For example:```haskell
import qualified Data.Text as Textmain :: IO ()
main = successMessage $ Text.pack "All set up!"
```
### Usage with StackIf `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:```yaml
extra-deps:
- colourista-0.1.0.0
- ...
```Then you can add it as a dependency in your `package.yaml` file as usual:
```yaml
library:
dependencies:
- colourista
```Great!
## Acknowledgement
Icons made by [Freepik](http://www.freepik.com) from [www.flaticon.com](https://www.flaticon.com/) is licensed by [CC 3.0 BY](http://creativecommons.org/licenses/by/3.0/).