HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduleansi-terminal-types-1.1.3Haskell2010

System.Console.ANSI.Types

The 'ANSI' standards refer to the visual style of displaying characters as their 'graphic rendition'. The style includes the color of a character, its background, or (where supported) its underlining; the intensity (bold, normal or faint) of a character; or whether the character is italic or underlined (single, double, curly, dotted or dashed), blinking (slowly or rapidly) or visible or not. The 'ANSI' codes to establish the graphic rendition for subsequent text are referred to as SELECT GRAPHIC RENDITION (SGR).

This module exports types and functions used to represent SGR aspects. See also System.Console.ANSI.setSGR and related functions provided by the ansi-terminal package.

  • 7 types
  • 3 values

Types used to represent SGR aspects

7 declarations
datadata SGR
#

ANSI Select Graphic Rendition (SGR) command

In respect of colors, there are three alternative commands:

  1. the 'ANSI' standards allow for eight standard colors (with two intensities). Windows and many other terminals (including xterm) allow the user to redefine the standard colors (so, for example Vivid Green may not correspond to bright green;

  2. an extension of the standard that allows true colors (24 bit color depth) in RGB space. This is usually the best alternative for more colors; and

  3. another extension that allows a palette of 256 colors, each color specified by an index. Xterm provides a protocol for a palette of 256 colors that many other terminals, including Windows 10, follow. Some terminals (including xterm) allow the user to redefine some or all of the palette colors.

Constructors

Instances3Eq, Read, Show
  • Eq SGRDefined in ansi-terminal-types-1.1.3 · System.Console.ANSI.Types
  • Read SGRDefined in ansi-terminal-types-1.1.3 · System.Console.ANSI.Types
  • Show SGRDefined in ansi-terminal-types-1.1.3 · System.Console.ANSI.Types
datadata ConsoleLayer
#

ANSI colors can be set on three different layers

Constructors

Instances7Bounded, Enum, Eq, Ord, Read, Show, …
  • Bounded ConsoleLayerDefined in ansi-terminal-types-1.1.3 · System.Console.ANSI.Types
  • Enum ConsoleLayerDefined in ansi-terminal-types-1.1.3 · System.Console.ANSI.Types
  • Eq ConsoleLayerDefined in ansi-terminal-types-1.1.3 · System.Console.ANSI.Types
  • Ord ConsoleLayerDefined in ansi-terminal-types-1.1.3 · System.Console.ANSI.Types
  • Read ConsoleLayerDefined in ansi-terminal-types-1.1.3 · System.Console.ANSI.Types
  • Show ConsoleLayerDefined in ansi-terminal-types-1.1.3 · System.Console.ANSI.Types
  • Ix ConsoleLayerDefined in ansi-terminal-types-1.1.3 · System.Console.ANSI.Types
datadata Color
#

ANSI's eight standard colors. They come in two intensities, which are controlled by ColorIntensity. Many terminals allow the colors of the standard palette to be customised, so that, for example, setSGR [ SetColor Foreground Vivid Green ] may not result in bright green characters.

Instances7Bounded, Enum, Eq, Ord, Read, Show, …
  • Bounded ColorDefined in ansi-terminal-types-1.1.3 · System.Console.ANSI.Types
  • Enum ColorDefined in ansi-terminal-types-1.1.3 · System.Console.ANSI.Types
  • Eq ColorDefined in ansi-terminal-types-1.1.3 · System.Console.ANSI.Types
  • Ord ColorDefined in ansi-terminal-types-1.1.3 · System.Console.ANSI.Types
  • Read ColorDefined in ansi-terminal-types-1.1.3 · System.Console.ANSI.Types
  • Show ColorDefined in ansi-terminal-types-1.1.3 · System.Console.ANSI.Types
  • Ix ColorDefined in ansi-terminal-types-1.1.3 · System.Console.ANSI.Types
datadata ColorIntensity
#

ANSI's standard colors come in two intensities

Instances7Bounded, Enum, Eq, Ord, Read, Show, …
datadata ConsoleIntensity
#

ANSI general console intensity: usually treated as setting the font style (e.g. BoldIntensity causes text to be bold)

Constructors

Instances7Bounded, Enum, Eq, Ord, Read, Show, …
datadata Underlining
#

ANSI text underlining

Constructors

Instances7Bounded, Enum, Eq, Ord, Read, Show, …
  • Bounded UnderliningDefined in ansi-terminal-types-1.1.3 · System.Console.ANSI.Types
  • Enum UnderliningDefined in ansi-terminal-types-1.1.3 · System.Console.ANSI.Types
  • Eq UnderliningDefined in ansi-terminal-types-1.1.3 · System.Console.ANSI.Types
  • Ord UnderliningDefined in ansi-terminal-types-1.1.3 · System.Console.ANSI.Types
  • Read UnderliningDefined in ansi-terminal-types-1.1.3 · System.Console.ANSI.Types
  • Show UnderliningDefined in ansi-terminal-types-1.1.3 · System.Console.ANSI.Types
  • Ix UnderliningDefined in ansi-terminal-types-1.1.3 · System.Console.ANSI.Types
datadata BlinkSpeed
#

ANSI blink speeds: values other than NoBlink are not widely supported

Constructors

Instances7Bounded, Enum, Eq, Ord, Read, Show, …
  • Bounded BlinkSpeedDefined in ansi-terminal-types-1.1.3 · System.Console.ANSI.Types
  • Enum BlinkSpeedDefined in ansi-terminal-types-1.1.3 · System.Console.ANSI.Types
  • Eq BlinkSpeedDefined in ansi-terminal-types-1.1.3 · System.Console.ANSI.Types
  • Ord BlinkSpeedDefined in ansi-terminal-types-1.1.3 · System.Console.ANSI.Types
  • Read BlinkSpeedDefined in ansi-terminal-types-1.1.3 · System.Console.ANSI.Types
  • Show BlinkSpeedDefined in ansi-terminal-types-1.1.3 · System.Console.ANSI.Types
  • Ix BlinkSpeedDefined in ansi-terminal-types-1.1.3 · System.Console.ANSI.Types

Constructors of xterm 256-color palette indices

3 declarations
valuexterm6LevelRGB :: Int -> Int -> Int -> Word8
#

Given xterm's standard protocol for a 256-color palette, returns the index to that part of the palette which is a 6 level (6x6x6) color cube of 216 RGB colors. Throws an error if any of the red, green or blue channels is outside the range 0 to 5. An example of use is:

Example1 expression
setSGR [ SetPaletteColor $ xterm6LevelRGB 5 2 0 ] -- Dark Orange
valuexterm24LevelGray :: Int -> Word8
#

Given xterm's standard protocol for a 256-color palette, returns the index to that part of the palette which is a spectrum of 24 grays, from dark gray (0) to near white (23) (black and white are themselves excluded). Throws an error if the gray is outside of the range 0 to 23. An example of use is:

Example1 expression
setSGR [ SetPaletteColor $ xterm24LevelGray 12 ] -- Gray50

Given xterm's standard protocol for a 256-color palette, returns the index to that part of the palette which corresponds to the 'ANSI' standards' 16 standard, or 'system', colors (eight colors in two intensities). An example of use is:

Example1 expression
setSGR [ SetPaletteColor $ xtermSystem Vivid Green ]