basement-0.0.16: Foundation scrap box of array & string

License | BSD-style
Maintainer | Vincent Hanquez <vincent@snarc.org>
Safe Haskell | None
Language | Haskell2010

Basement.Terminal.ANSI

Contents

- Types
- Simple ANSI escape factory functions

Description

ANSI Terminal escape for cursor and attributes manipulations

On Unix system, it should be supported by most terminal emulators.

On Windows system, all escape sequences are empty for maximum compatibility purpose, and easy implementation. newer version of Windows 10 supports ANSI escape now, but we'll need some kind of detection.

Synopsis

- type Escape = String
- type Displacement = Word64
- type ColorComponent = Zn64 8
- type GrayComponent = Zn64 24
- type RGBComponent = Zn64 6
- cursorUp :: Displacement -> Escape
- cursorDown :: Displacement -> Escape
- cursorForward :: Displacement -> Escape
- cursorBack :: Displacement -> Escape
- cursorNextLine :: Displacement -> Escape
- cursorPrevLine :: Displacement -> Escape
- cursorHorizontalAbsolute :: Displacement -> Escape
- cursorPosition :: Displacement -> Displacement -> Escape
- eraseScreenFromCursor :: Escape
- eraseScreenToCursor :: Escape
- eraseScreenAll :: Escape
- eraseLineFromCursor :: Escape
- eraseLineToCursor :: Escape
- eraseLineAll :: Escape
- scrollUp :: Displacement -> Escape
- scrollDown :: Displacement -> Escape
- sgrReset :: Escape
- sgrForeground :: ColorComponent -> Bool -> Escape
- sgrBackground :: ColorComponent -> Bool -> Escape
- sgrForegroundGray24 :: GrayComponent -> Escape
- sgrBackgroundGray24 :: GrayComponent -> Escape
- sgrForegroundColor216 :: RGBComponent -> RGBComponent -> RGBComponent -> Escape
- sgrBackgroundColor216 :: RGBComponent -> RGBComponent -> RGBComponent -> Escape

# Types

type Escape = String Source #

type Displacement = Word64 Source #

type ColorComponent = Zn64 8 Source #

Simple color component on 8 color terminal (maximum compatibility)

type GrayComponent = Zn64 24 Source #

Gray color compent on 256colors terminals

type RGBComponent = Zn64 6 Source #

Color compent on 256colors terminals

# Simple ANSI escape factory functions

cursorUp :: Displacement -> Escape Source #

cursorDown :: Displacement -> Escape Source #

cursorForward :: Displacement -> Escape Source #

cursorBack :: Displacement -> Escape Source #

cursorNextLine :: Displacement -> Escape Source #

cursorPrevLine :: Displacement -> Escape Source #

cursorHorizontalAbsolute :: Displacement -> Escape Source #

cursorPosition :: Displacement -> Displacement -> Escape Source #

eraseScreenFromCursor :: Escape Source #

eraseScreenToCursor :: Escape Source #

eraseScreenAll :: Escape Source #

eraseLineFromCursor :: Escape Source #

eraseLineToCursor :: Escape Source #

eraseLineAll :: Escape Source #

scrollUp :: Displacement -> Escape Source #

scrollDown :: Displacement -> Escape Source #

sgrReset :: Escape Source #

All attribute off

sgrForeground :: ColorComponent -> Bool -> Escape Source #

8 Colors + Bold attribute for foreground

sgrBackground :: ColorComponent -> Bool -> Escape Source #

8 Colors + Bold attribute for background

sgrForegroundGray24 :: GrayComponent -> Escape Source #

sgrBackgroundGray24 :: GrayComponent -> Escape Source #

sgrForegroundColor216 Source #

Arguments

:: RGBComponent | Red component
-> RGBComponent | Green component
-> RGBComponent | Blue component
-> Escape |

sgrBackgroundColor216 Source #

Arguments

:: RGBComponent | Red component
-> RGBComponent | Green component
-> RGBComponent | Blue component
-> Escape |