text-ansi-0.3.0.1: Text styling for ANSI terminals.

Safe Haskell | None
Language | Haskell2010

Text.ANSI

Contents

- Foreground color
- Background color
- Style

Synopsis

- black :: Text -> Text
- red :: Text -> Text
- green :: Text -> Text
- yellow :: Text -> Text
- blue :: Text -> Text
- magenta :: Text -> Text
- cyan :: Text -> Text
- white :: Text -> Text
- brightBlack :: Text -> Text
- brightRed :: Text -> Text
- brightGreen :: Text -> Text
- brightYellow :: Text -> Text
- brightBlue :: Text -> Text
- brightMagenta :: Text -> Text
- brightCyan :: Text -> Text
- brightWhite :: Text -> Text
- rgb :: Word8 -> Word8 -> Word8 -> Text -> Text
- blackBg :: Text -> Text
- redBg :: Text -> Text
- greenBg :: Text -> Text
- yellowBg :: Text -> Text
- blueBg :: Text -> Text
- magentaBg :: Text -> Text
- cyanBg :: Text -> Text
- whiteBg :: Text -> Text
- brightBlackBg :: Text -> Text
- brightRedBg :: Text -> Text
- brightGreenBg :: Text -> Text
- brightYellowBg :: Text -> Text
- brightBlueBg :: Text -> Text
- brightMagentaBg :: Text -> Text
- brightCyanBg :: Text -> Text
- brightWhiteBg :: Text -> Text
- rgbBg :: Word8 -> Word8 -> Word8 -> Text -> Text
- bold :: Text -> Text
- faint :: Text -> Text
- italic :: Text -> Text
- underline :: Text -> Text
- doubleUnderline :: Text -> Text
- strikethrough :: Text -> Text
- frame :: Text -> Text
- encircle :: Text -> Text
- overline :: Text -> Text

# Documentation

Text styling for ANSI terminals using SGR codes, as defined by the ECMA-48 standard.

Supports foreground/background color, bold/faint intensity, italic, single/double underline, strikethrough, frame, encircle, and overline escape sequences. Some styles may not work on your terminal.

Also features terminal detection, so redirecting styled output to a file will automatically strip the ANSI escape sequences.

# Foreground color

black :: Text -> Text Source #

Black foreground.

red :: Text -> Text Source #

Red foreground.

green :: Text -> Text Source #

Green foreground.

yellow :: Text -> Text Source #

Yellow foreground.

blue :: Text -> Text Source #

Blue foreground.

magenta :: Text -> Text Source #

Magenta foreground.

cyan :: Text -> Text Source #

Cyan foreground.

white :: Text -> Text Source #

White foreground.

brightBlack :: Text -> Text Source #

Bright black foreground.

brightRed :: Text -> Text Source #

Bright red foreground.

brightGreen :: Text -> Text Source #

Bright green foreground.

brightYellow :: Text -> Text Source #

Bright yellow foreground.

brightBlue :: Text -> Text Source #

Bright blue foreground.

brightMagenta :: Text -> Text Source #

Bright magenta foreground.

brightCyan :: Text -> Text Source #

Bright cyan foreground.

brightWhite :: Text -> Text Source #

Bright white foreground.

rgb :: Word8 -> Word8 -> Word8 -> Text -> Text Source #

RGB foreground.

# Background color

blackBg :: Text -> Text Source #

Black background.

redBg :: Text -> Text Source #

Red background.

greenBg :: Text -> Text Source #

Green background.

yellowBg :: Text -> Text Source #

Yellow background.

blueBg :: Text -> Text Source #

Blue background.

magentaBg :: Text -> Text Source #

Magenta background.

cyanBg :: Text -> Text Source #

Cyan background.

whiteBg :: Text -> Text Source #

White background.

brightBlackBg :: Text -> Text Source #

Bright black background.

brightRedBg :: Text -> Text Source #

Bright red background.

brightGreenBg :: Text -> Text Source #

Bright green background.

brightYellowBg :: Text -> Text Source #

Bright yellow background.

brightBlueBg :: Text -> Text Source #

Bright blue background.

brightMagentaBg :: Text -> Text Source #

Bright magenta background.

brightCyanBg :: Text -> Text Source #

Bright cyan background.

brightWhiteBg :: Text -> Text Source #

Bright white background.

rgbBg :: Word8 -> Word8 -> Word8 -> Text -> Text Source #

RGB background.

# Style

bold :: Text -> Text Source #

Bold style (high intensity).

faint :: Text -> Text Source #

Faint style (low intensity).

italic :: Text -> Text Source #

Italic style.

underline :: Text -> Text Source #

U̲n̲d̲e̲r̲l̲i̲n̲e̲ style.

doubleUnderline :: Text -> Text Source #

D̳o̳u̳b̳l̳e̳ ̳u̳n̳d̳e̳r̳l̳i̳n̳e̳ style.

strikethrough :: Text -> Text Source #

S̶t̶r̶i̶k̶e̶t̶h̶r̶o̶u̶g̶h̶ style.

frame :: Text -> Text Source #

Frame style.

encircle :: Text -> Text Source #

Encircle style.

overline :: Text -> Text Source #

O̅v̅e̅r̅l̅i̅n̅e̅ style.