License | BSD-style |
---|---|
Maintainer | Vincent Hanquez <[email protected]> |
Safe Haskell | None |
Language | Haskell2010 |
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 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 #
cursorPosition :: Displacement -> Displacement -> Escape Source #
scrollUp :: Displacement -> Escape Source #
scrollDown :: Displacement -> Escape Source #
sgrForeground :: ColorComponent -> Bool -> Escape Source #
8 Colors + Bold attribute for foreground
sgrBackground :: ColorComponent -> Bool -> Escape Source #
8 Colors + Bold attribute for background
sgrForegroundColor216 Source #
:: RGBComponent | Red component |
-> RGBComponent | Green component |
-> RGBComponent | Blue component |
-> Escape |
sgrBackgroundColor216 Source #
:: RGBComponent | Red component |
-> RGBComponent | Green component |
-> RGBComponent | Blue component |
-> Escape |