Z-IO-0.2.0.0: Simple and high performance IO toolkit for Haskell
Copyright(c) Winterland 2017-2020
LicenseBSD
Maintainerdrkoster@qq.com
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Z.IO.StdStream.Ansi

Description

Provides utilities to build code sequences https://en.wikipedia.org/wiki/ANSI_escape_code.

> putStd . bold . italicize . color Red  $ "hello"
hello   -- bold, italicize and red
Synopsis

Style modifier

italicize :: Builder () -> Builder () Source #

Italicize some text

underline :: Builder () -> Builder () Source #

Add single underline to some text

color :: AnsiColor -> Builder () -> Builder () Source #

Colorized some text

color' :: AnsiColor -> AnsiColor -> Builder () -> Builder () Source #

Colorized some text with background color

palette :: PaletteColor -> Builder () -> Builder () Source #

Colorized some text

palette' :: PaletteColor -> PaletteColor -> Builder () -> Builder () Source #

Colorized some text with background color

rgb :: RGBColor -> Builder () -> Builder () Source #

Colorized some text

rgb' :: RGBColor -> RGBColor -> Builder () -> Builder () Source #

Colorized some text with background color

Control codes

cursorUp Source #

Arguments

:: Int

Number of lines or characters to move

-> Builder () 

cursorDown Source #

Arguments

:: Int

Number of lines or characters to move

-> Builder () 

cursorForward Source #

Arguments

:: Int

Number of lines or characters to move

-> Builder () 

cursorBackward Source #

Arguments

:: Int

Number of lines or characters to move

-> Builder () 

cursorDownLine Source #

Arguments

:: Int

Number of lines to move

-> Builder () 

cursorUpLine Source #

Arguments

:: Int

Number of lines to move

-> Builder () 

setCursorColumn Source #

Arguments

:: Int

1-based column to move to

-> Builder () 

Code to move the cursor to the specified column. The column numbering is 1-based (that is, the left-most column is numbered 1).

setCursorPosition Source #

Arguments

:: Int

1-based row to move to

-> Int

1-based column to move to

-> Builder () 

Code to move the cursor to the specified position (row and column). The position is 1-based (that is, the top-left corner is at row 1 column 1).

scrollPageUp Source #

Arguments

:: Int

Number of lines to scroll by

-> Builder () 

scrollPageDown Source #

Arguments

:: Int

Number of lines to scroll by

-> Builder () 

setTitle Source #

Arguments

:: Text

New Icon Name and Window Title

-> Builder () 

XTerm control sequence to set the Icon Name and Window Title.

Style codes

slowBlink :: Builder () Source #

less than 150 per minute

rapidBlink :: Builder () Source #

MS-DOS ANSI.SYS, 150+ per minute; not widely supported

conceal :: Builder () Source #

Aka Hide, not widely supported.

invert :: Builder () Source #

Swap foreground and background colors, inconsistent emulation

data AnsiColor Source #

ANSI's eight standard colors

Constructors

Black 
Red 
Green 
Yellow 
Blue 
Magenta 
Cyan 
White 

Instances

Instances details
Bounded AnsiColor Source # 
Instance details

Defined in Z.IO.StdStream.Ansi

Enum AnsiColor Source # 
Instance details

Defined in Z.IO.StdStream.Ansi

Eq AnsiColor Source # 
Instance details

Defined in Z.IO.StdStream.Ansi

Ord AnsiColor Source # 
Instance details

Defined in Z.IO.StdStream.Ansi

Read AnsiColor Source # 
Instance details

Defined in Z.IO.StdStream.Ansi

Show AnsiColor Source # 
Instance details

Defined in Z.IO.StdStream.Ansi

Generic AnsiColor Source # 
Instance details

Defined in Z.IO.StdStream.Ansi

Associated Types

type Rep AnsiColor :: Type -> Type #

ShowT AnsiColor Source # 
Instance details

Defined in Z.IO.StdStream.Ansi

Methods

toUTF8BuilderP :: Int -> AnsiColor -> Builder () #

type Rep AnsiColor Source # 
Instance details

Defined in Z.IO.StdStream.Ansi

type Rep AnsiColor = D1 ('MetaData "AnsiColor" "Z.IO.StdStream.Ansi" "Z-IO-0.2.0.0-9WozHvkV8CCkBNKN4MqC3" 'False) (((C1 ('MetaCons "Black" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Red" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Green" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Yellow" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "Blue" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Magenta" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Cyan" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "White" 'PrefixI 'False) (U1 :: Type -> Type))))

type RGBColor = (Word8, Word8, Word8) Source #

24-bit RGB color

Internal helper

csi Source #

Arguments

:: [Int]

List of parameters for the control sequence

-> Builder ()

Character(s) that identify the control function

-> Builder () 

sgr Source #

Arguments

:: [Word8]

List of sgr code for the control sequence

-> Builder ()