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

Modulevty-6.5Haskell2010

Graphics.Vty.Attributes

Display attributes

Attributes have three components: a foreground color, a background color, and a style mask. The simplest attribute is the default attribute, or defAttr. Attributes can be modified with withForeColor, withBackColor, and withStyle, e.g.,

    defAttr `withForeColor` red

Image constructors often require an Attr to indicate the attributes used in the image, e.g.,

    string (defAttr `withForeColor` red) "this text will be red"

The appearance of Images using defAttr is determined by the The terminal, so this is not something VTY can control. The user is free to The define the color scheme of the terminal as they see fit.

The value currentAttr will keep the attributes of whatever was output previously.

  • 4 types
  • 17 values
  • Packagevty-6.5
  • Exports21
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceAttributes.hs
datadata Attr
#

A display attribute defines the Color and Style of all the characters rendered after the attribute is applied.

At most 256 colors, picked from a 240 and 16 color palette, are possible for the background and foreground. The 240 colors and 16 colors are points in different palettes. See Color for more information.

Instances6Eq, Read, Show, Generic, NFData, Rep
datadata FixedAttr
#

Specifies the display attributes such that the final style and color values do not depend on the previously applied display attribute. The display attributes can still depend on the terminal's default colors (unfortunately).

Instances2Eq, Show
datadata MaybeDefault v
#

The style and color attributes can either be the terminal defaults. Or be equivalent to the previously applied style. Or be a specific value.

Instances4Eq, Read, Show, NFData
valuedefAttr :: Attr
#

Sets the style, background color and foreground color to the default values for the terminal. There is no easy way to determine what the default background and foreground colors are.

valuecurrentAttr :: Attr
#

Keeps the style, background color and foreground color that was previously set. Used to override some part of the previous style.

EG: current_style withForeColor brightMagenta

Would be the currently applied style (be it underline, bold, etc) but with the foreground color set to brightMagenta.

Styles

13 declarations
typetype Style = Word8
#

Styles are represented as an 8 bit word. Each bit in the word is 1 if the style attribute assigned to that bit should be applied and 0 if the style attribute should not be applied.

valuestandout :: Style
#

Valid style attributes include:

  • standout

  • underline

  • reverseVideo

  • blink

  • dim

  • bold/bright

  • italic

  • strikethrough (via the smxx/rmxx terminfo capabilities)

(The invisible, protect, and altcharset display attributes some terminals support are not supported via VTY.)

valueitalic :: Style
#

Valid style attributes include:

  • standout

  • underline

  • reverseVideo

  • blink

  • dim

  • bold/bright

  • italic

  • strikethrough (via the smxx/rmxx terminfo capabilities)

(The invisible, protect, and altcharset display attributes some terminals support are not supported via VTY.)

valuestrikethrough :: Style
#

Valid style attributes include:

  • standout

  • underline

  • reverseVideo

  • blink

  • dim

  • bold/bright

  • italic

  • strikethrough (via the smxx/rmxx terminfo capabilities)

(The invisible, protect, and altcharset display attributes some terminals support are not supported via VTY.)

valueunderline :: Style
#

Valid style attributes include:

  • standout

  • underline

  • reverseVideo

  • blink

  • dim

  • bold/bright

  • italic

  • strikethrough (via the smxx/rmxx terminfo capabilities)

(The invisible, protect, and altcharset display attributes some terminals support are not supported via VTY.)

valuereverseVideo :: Style
#

Valid style attributes include:

  • standout

  • underline

  • reverseVideo

  • blink

  • dim

  • bold/bright

  • italic

  • strikethrough (via the smxx/rmxx terminfo capabilities)

(The invisible, protect, and altcharset display attributes some terminals support are not supported via VTY.)

valuedim :: Style
#

Valid style attributes include:

  • standout

  • underline

  • reverseVideo

  • blink

  • dim

  • bold/bright

  • italic

  • strikethrough (via the smxx/rmxx terminfo capabilities)

(The invisible, protect, and altcharset display attributes some terminals support are not supported via VTY.)

valuebold :: Style
#

Valid style attributes include:

  • standout

  • underline

  • reverseVideo

  • blink

  • dim

  • bold/bright

  • italic

  • strikethrough (via the smxx/rmxx terminfo capabilities)

(The invisible, protect, and altcharset display attributes some terminals support are not supported via VTY.)

Setting attribute colors

2 declarations

Setting hyperlinks

1 declaration
valuewithURL :: Attr -> Text -> Attr
#

Add a hyperlinked URL using the proposed escape sequences for hyperlinked URLs. These escape sequences are comparatively new and aren't widely supported in terminal emulators yet, but most terminal emulators that don't know about these sequences will ignore these sequences, and therefore this should fall back sensibly. In some cases they won't and this will result in garbage, so this is why hyperlinking is disabled by default, in which case this combinator has no observable effect. To enable it, enable Hyperlink mode on your Vty output interface.