The ansi-terminal package

[ Tags: bsd3, library, user-interfaces ] [ Propose Tags ]

ANSI terminal support for Haskell: allows cursor movement, screen clearing, color output, showing or hiding the cursor, and changing the title. Works on UNIX and Windows.


[Skip to Readme]

Properties

Versions 0.1, 0.2, 0.2.1, 0.3.0, 0.3.1, 0.4.0, 0.5.0, 0.5.1, 0.5.2, 0.5.3, 0.5.4, 0.5.5, 0.5.5.1, 0.6, 0.6.1, 0.6.1.1, 0.6.2, 0.6.2.1, 0.6.2.2, 0.6.2.3, 0.6.3, 0.6.3.1, 0.7, 0.7.1, 0.7.1.1
Change log CHANGELOG.md
Dependencies base (==4.*), base-compat (>=0.9.1), colour, containers, process, Win32 (>=2.0) [details]
License BSD3
Author Max Bolingbroke
Maintainer Roman Cheplyaka <roma@ro-che.info>
Category User Interfaces
Home page https://github.com/feuerbach/ansi-terminal
Source repository head: git clone git://github.com/feuerbach/ansi-terminal.git
Uploaded Thu Sep 7 06:19:03 UTC 2017 by RomanCheplyaka
Distributions Arch:0.6.3.1, Debian:0.6.2.3, Fedora:0.6.2.3, FreeBSD:0.6.2.1, LTSHaskell:0.6.3.1, NixOS:0.7.1.1, Stackage:0.6.3.1, Tumbleweed:0.6.3.1
Executables ansi-terminal-example
Downloads 249947 total (14325 in the last 30 days)
Rating 2.25 (2 ratings) [clear rating]
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2017-09-07 [all 1 reports]
Hackage Matrix CI

Modules

[Index]

Flags

NameDescriptionDefaultType
example

Build the example application

DisabledAutomatic

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for ansi-terminal-0.7.1.1

[back to package description]

ansi-terminal

Haskell ANSI Terminal Package For Windows, OS X and Linux

Description

ANSI terminal support for Haskell, which allows:

  • Cursor movement
  • Screen and line clearing
  • Color output
  • Showing or hiding the cursor
  • Changing the console title (though this is not strictly part of ANSI, it is widely supported in Unix)

It is compatible with Windows (via an emulation layer) and those Unixes with ANSI terminals.

If you like this, you may be interested in ansi-wl-pprint, which provides a pretty-printer that can construct strings containing ANSI colorisation.

Not all of the ANSI escape codes are provided by this module, but most (if not all) of the popular and well supported ones are. For a full list, have a look at the current version of the API. Each supported escape code or family of codes has a corresponding function that comes in three variants:

  • A straight IO variant that doesn't take a Handle and just applies the ANSI escape code to the terminal attached to stdout
  • An IO variant similar to above, but which takes a Handle to which the ANSI escape should be applied
  • A String variant that returns a literal string that should be included to get the effect of the code. This is the only one of the three API variants that only works on Unix-like operating systems: on Windows these strings will always be blank!

Example

A full example is available, but for a taste of how the library works try the following code:

import System.Console.ANSI

main = do
    setCursorPosition 5 0
    setTitle "ANSI Terminal Short Example"

    setSGR [ SetConsoleIntensity BoldIntensity
           , SetColor Foreground Vivid Red
           ]
    putStr "Hello"

    setSGR [ SetConsoleIntensity NormalIntensity
           , SetColor Foreground Vivid White
           , SetColor Background Dull Blue
           ]
    putStrLn "World!"

Documentation

Haddock documentation is available at Hackage.

Credits

The library is originally written by Max Bolingbroke

Maintainers

Roman Cheplyaka is the primary maintainer.

Oliver Charles is the backup maintainer. Please get in touch with him if the primary maintainer cannot be reached.