The pretty-terminal package

[ Tags: bsd3, library, program, terminal ] [ Propose Tags ]

Please see the README on Github at https://github.com/loganmac/pretty-terminal#readme


[Skip to Readme]

Properties

Versions 0.1.0.0
Change log ChangeLog.md
Dependencies base (>=4.7 && <5), pretty-terminal, text [details]
License BSD3
Copyright 2018 Logan McPhail
Author Logan McPhail
Maintainer logan.airnomad@gmail.com
Category Terminal
Home page https://github.com/loganmac/pretty-terminal#readme
Bug tracker https://github.com/loganmac/pretty-terminal/issues
Source repo head: git clone https://github.com/loganmac/pretty-terminal
Uploaded Sat Feb 3 07:19:10 UTC 2018 by loganmac
Distributions NixOS:0.1.0.0
Executables example
Downloads 25 total (25 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2018-02-03 [all 1 reports]
Hackage Matrix CI

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for pretty-terminal-0.1.0.0

[back to package description]

pretty-terminal

Example

{-# LANGUAGE OverloadedStrings #-}
module Main where

import qualified Data.Text.IO          as T
import           System.Console.Pretty (Color (..), Style (..), bgColor, color,
                                        style, supportsPretty)

main :: IO ()
main = do
  inColor <- supportsPretty
  if inColor then example
             else putStrLn "Sorry, this terminal doesn't support pretty ANSI codes"

example :: IO ()
example = do
  -- simple style
  putStrLn ( style Underline "hello there!" )

  -- simple color
  putStrLn ( color Yellow "this lib was designed to be easy" )

  -- simple background
  putStrLn ( bgColor Blue "and the functions layer together easily" )

  -- combining
  putStrLn ( bgColor White . color Red . style Bold $ "like so!" )

  -- custom style & color
  let primary = bgColor Magenta . color Green . style Italic
  putStrLn ( primary "easily create your own helpers & styles" )

  -- with both unicode string types
  putStrLn ( color Cyan "String...")
  T.putStrLn (color Red "and Text")

  -- set styling to none
  putStrLn ( primary $ style Normal "or if you need to remove any styling..." )