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

Safe HaskellSafe-Inferred
LanguageHaskell2010

Rainbow.Colors

Contents

Description

Ordinarily you should not need this module; typically you will just import Rainbow, which re-exports the most useful things from this module. This module also contains data constructors that Rainbow does not re-export.

Synopsis

8 color

noColor8 :: Color8 Source

Resets the color (foreground or background, as appropriate) to the default for your terminal. Usually you will not need this, as each Chunk starts out with the terminal's default colors.

256 color

noColor256 :: Color256 Source

Resets the color (foreground or background, as appropriate) to the default for your terminal. Usually you will not need this, as each Chunk starts out with the terminal's default colors.

Both 8- and 256-color terminals

data Radiant Source

A Radiant affects both 8- and 256-color terminals. (It does not necessarily affect both the foreground and background; whether it affects the foreground, background, or both depends upon the context in which it is used.)

Constructors

Radiant 

Fields

rad8 :: Color8
 
rad256 :: Maybe Color256

If Nothing, use the rad8 color on 256-color terminals.

Instances

Eq Radiant 
Ord Radiant 
Show Radiant 
Color Radiant

Affects the foreground and background of both 8- and 256-color terminals.

both :: Color8 -> Radiant Source

A Radiant with the same color for both 8- and 256-color terminals.

noColorRadiant :: Radiant Source

A Radiant that uses the terminal's default colors for both 8- and 256-color terminals.

class Color a where Source

Changing colors. Instances of this class affect the background or the foreground color. For example, to get a Chunk that changes the background to red, use back red; for the foreground, use fore red. Whether 8-color or 256-color terminals (or both) are affected depends on the particular instance.

Because Word8 is an instance of Color, you can use literals to affect the color of 256-color terminals. For example, if you have a 256 color terminal:

putChunkLn $ "muddy yellow background" <> back (100 :: Word8)

This example would not affect an 8-color terminal, as the Word8 instance affects 256-color terminals only.

Methods

back :: a -> Chunk Source

Create a Chunk that affects the background color only.

fore :: a -> Chunk Source

Create a Chunk that affects the foreground color only.

Instances

Color Word8

Affects the foreground and background of 256-color terminals.

Color Color256 
Color Color8 
Color Enum8

Affects the foreground and background of 8-color terminals.

Color Radiant

Affects the foreground and background of both 8- and 256-color terminals.