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

Safe HaskellNone
LanguageHaskell2010

Rainbow.Types

Description

All the main types in Rainbow. Using this module you can specify that you want different formatting for 8- and 256-color terminals. Many of the names in this module conflict with the names in Rainbow, so it's probably best to import this module qualified.

Synopsis

Documentation

newtype Color a Source

A color; a Nothing value means that the terminal's default color is used. The type of the Maybe generally will be an Enum8 to represent one of 8 colors, or a Word8 to represent one of 256 colors.

Constructors

Color (Maybe a) 

Instances

Functor Color 
Foldable Color 
Traversable Color 
Eq a => Eq (Color a) 
Ord a => Ord (Color a) 
Show a => Show (Color a) 
Generic (Color a) 
Monoid (Color a)

Takes the last non-Nothing Color. mempty is no color.

Wrapped (Color a) 
(~) * (Color a1) t0 => Rewrapped (Color a) t 
Typeable (* -> *) Color 
type Rep (Color a) 
type Unwrapped (Color a0) = Maybe a0 

data Enum8 Source

A simple enumeration for eight values. Represents eight colors.

Constructors

E0 
E1 
E2 
E3 
E4 
E5 
E6 
E7 

data Format Source

Text formatting such as bold, italic, etc.

Constructors

Format 

Instances

Eq Format 
Ord Format 
Show Format 
Generic Format 
Monoid Format

For each field, the resulting field is True if either field is True. For mempty, every field is False.

Typeable * Format 
type Rep Format 

data Style a Source

The foreground and background color, and the Format. This represents all colors and formatting attributes for either an 8- or 256-color terminal.

Constructors

Style 

Fields

_fore :: Color a
 
_back :: Color a
 
_format :: Format
 

Instances

Functor Style 
Foldable Style 
Traversable Style 
Eq a => Eq (Style a) 
Ord a => Ord (Style a) 
Show a => Show (Style a) 
Generic (Style a) 
Monoid (Style a)

Uses the underlying Monoid instances for Color and Format.

Typeable (* -> *) Style 
type Rep (Style a) 

format :: forall a. Lens' (Style a) Format Source

fore :: forall a. Lens' (Style a) (Color a) Source

back :: forall a. Lens' (Style a) (Color a) Source

data Scheme Source

Holds the Style for both 8- and 256-color terminals.

Constructors

Scheme 

data Chunk a 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

_scheme :: Scheme
 
_yarn :: a
 

Instances

Functor Chunk 
Foldable Chunk 
Traversable Chunk 
Eq a => Eq (Chunk a) 
Ord a => Ord (Chunk a) 
Show a => Show (Chunk a) 
Generic (Chunk a) 
Monoid a => Monoid (Chunk a)

Uses the underlying Monoid instances for the Style and for the particular _yarn. Therefore mempty will have no formatting and no colors and will generally have no text, though whether or not there is any text depends on the mempty for the type of the _yarn.

Typeable (* -> *) Chunk 
type Rep (Chunk a) 

chunk :: a -> Chunk a Source

Creates a Chunk with no formatting and with the given text.

yarn :: forall a a. Lens (Chunk a) (Chunk a) a a Source

scheme :: forall a. Lens' (Chunk a) Scheme Source

data Radiant Source

Stores colors that may affect 8-color terminals, 256-color terminals, both, or neither.

Constructors

Radiant 

Instances

Eq Radiant 
Ord Radiant 
Show Radiant 
Generic Radiant 
Monoid Radiant

Uses the underlying Monoid instance for the Colors. Thus the last non-Nothing Color is used. This can be useful to specify one color for 8-color terminals and a different color for 256-color terminals.

Typeable * Radiant 
type Rep Radiant