Text.ANSI

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 #

Black foreground.

red :: Text -> Text #

Red foreground.

green :: Text -> Text #

Green foreground.

yellow :: Text -> Text #

Yellow foreground.

blue :: Text -> Text #

Blue foreground.

magenta :: Text -> Text #

Magenta foreground.

cyan :: Text -> Text #

Cyan foreground.

white :: Text -> Text #

White foreground.

brightBlack :: Text -> Text #

Bright black foreground.

brightRed :: Text -> Text #

Bright red foreground.

brightGreen :: Text -> Text #

Bright green foreground.

brightYellow :: Text -> Text #

Bright yellow foreground.

brightBlue :: Text -> Text #

Bright blue foreground.

brightMagenta :: Text -> Text #

Bright magenta foreground.

brightCyan :: Text -> Text #

Bright cyan foreground.

brightWhite :: Text -> Text #

Bright white foreground.

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

RGB foreground.

# Background color

blackBg :: Text -> Text #

Black background.

redBg :: Text -> Text #

Red background.

greenBg :: Text -> Text #

Green background.

yellowBg :: Text -> Text #

Yellow background.

blueBg :: Text -> Text #

Blue background.

magentaBg :: Text -> Text #

Magenta background.

cyanBg :: Text -> Text #

Cyan background.

whiteBg :: Text -> Text #

White background.

brightBlackBg :: Text -> Text #

Bright black background.

brightRedBg :: Text -> Text #

Bright red background.

brightGreenBg :: Text -> Text #

Bright green background.

brightYellowBg :: Text -> Text #

Bright yellow background.

brightBlueBg :: Text -> Text #

Bright blue background.

brightMagentaBg :: Text -> Text #

Bright magenta background.

brightCyanBg :: Text -> Text #

Bright cyan background.

brightWhiteBg :: Text -> Text #

Bright white background.

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

RGB background.

# Style

bold :: Text -> Text #

Bold style (high intensity).

faint :: Text -> Text #

Faint style (low intensity).

italic :: Text -> Text #

Italic style.

underline :: Text -> Text #

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

doubleUnderline :: Text -> Text #

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

strikethrough :: Text -> Text #

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

frame :: Text -> Text #

Frame style.

encircle :: Text -> Text #

Encircle style.

overline :: Text -> Text #

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