rainbow-0.22.0.2: Print text to terminal with colors and effects

Safe HaskellSafe-Inferred
LanguageHaskell2010

Rainbow.Types

Description

The innards of Rainbow. Ordinarily you should not need this module; instead, just import Rainbow, which re-exports the most useful names from this module.

Synopsis

Documentation

data Enum8 Source

A simple enumeration for eight values.

Constructors

E0 
E1 
E2 
E3 
E4 
E5 
E6 
E7 

Instances

Bounded Enum8 
Enum Enum8 
Eq Enum8 
Ord Enum8 
Show Enum8 
Generic Enum8 
Color Enum8

Affects the foreground and background of 8-color terminals.

Typeable * Enum8 
type Rep Enum8 

newtype Color8 Source

Color for an 8-color terminal. Does not affect 256-color terminals.

Constructors

Color8 

Fields

unColor8 :: Maybe Enum8

Nothing indicates to use the default color for the terminal; otherwise, use the corresponding Terminfo Color.

newtype Color256 Source

Color for an 256-color terminal. Does not affect 8-color terminals.

Constructors

Color256 

Fields

unColor256 :: Maybe Word8

Nothing indicates to use the default color for the terminal; otherwise, use the corresponding Terminfo Color.

to256 :: Color8 -> Color256 Source

Any color for an 8-color terminal can also be used in a 256-color terminal.

data StyleCommon Source

Style elements that apply in both 8 and 256 color terminals. However, the elements are described separately for 8 and 256 color terminals, so that the text appearance can change depending on how many colors a terminal has.

data Style8 Source

Describes text appearance (foreground and background colors, as well as other attributes such as bold) for an 8 color terminal.

data Style256 Source

Describes text appearance (foreground and background colors, as well as other attributes such as bold) for a 256 color terminal.

data TextSpec Source

The TextSpec bundles together the styles for the 8 and 256 color terminals, so that the text can be portrayed on any terminal.

Constructors

TextSpec 

data Chunk Source

A chunk is some textual data coupled with a description of what color the text is, attributes like whether it is bold or underlined, etc. The chunk knows what foreground and background colors and what attributes to use for both an 8 color terminal and a 256 color terminal.

Constructors

Chunk 

Fields

chunkTextSpec :: TextSpec

Specifies all the effects (such as bold, underlining, colors, etc) that apply to this chunk, with different effects for 8 and 256 color terminals; and

chunkTexts :: [Text]
 

chunkFromText :: Text -> Chunk Source

Creates a Chunk from a strict Text with default colors and no special effects.

chunkFromTexts :: [Text] -> Chunk Source

Creates a Chunk from a list of strict Text with default colors and no special effects.

chunkFromLazyText :: Text -> Chunk Source

Creates a Chunk from a lazy Text with default colors and no special effects.

chunkFromLazyTexts :: [Text] -> Chunk Source

Creates a Chunk from a list of lazy Text with default colors and no special effects.

bold :: Chunk Source

Bold. What actually happens when you use Bold is going to depend on your terminal. For example, xterm allows you actually use a bold font for bold, if you have one. Otherwise, it might simulate bold by using overstriking. Another possibility is that your terminal might use a different color to indicate bold. For more details (at least for xterm), look at xterm (1) and search for boldColors.

If your terminal uses a different color for bold, this allows an 8-color terminal to really have 16 colors.