BSD-3-Clause licensed by Logan McPhail
Maintained by [email protected]
This version can be pinned in stack with:pretty-terminal-0.1.0.0@sha256:e9135d86ebb2a8e3aaf5a79088de4628dbd49988388e0fbfc26c5ecb3c399ad9,1638

Module documentation for 0.1.0.0

Used by 2 packages in nightly-2024-09-15(full list with versions):

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..." )

Changes

Changelog for pretty-terminal

Unreleased changes