hledger-lib-1.12: Core data types, parsers and functionality for the hledger accounting tools

Safe Haskell | Safe
Language | Haskell2010

Hledger.Utils.Color

Description

Basic color helpers for prettifying console output.

Synopsis

- color :: ColorIntensity -> Color -> String -> String
- bgColor :: ColorIntensity -> Color -> String -> String
- data Color
  - = Black
  - | Red
  - | Green
  - | Yellow
  - | Blue
  - | Magenta
  - | Cyan
  - | White
- data ColorIntensity
  - = Dull
  - | Vivid

# Documentation

color :: ColorIntensity -> Color -> String -> String Source #

Wrap a string in ANSI codes to set and reset foreground colour.

bgColor :: ColorIntensity -> Color -> String -> String Source #

Wrap a string in ANSI codes to set and reset background colour.

data Color Source #

ANSI colors: come in various intensities, which are controlled by `ColorIntensity`

Constructors

Black |
Red |
Green |
Yellow |
Blue |
Magenta |
Cyan |
White |

Instances

Bounded Color |
Instance details Defined in System.Console.ANSI.Types Methods minBound :: Color Source # maxBound :: Color Source #
Enum Color |
Instance details Defined in System.Console.ANSI.Types Methods succ :: Color -> Color Source # pred :: Color -> Color Source # toEnum :: Int -> Color Source # fromEnum :: Color -> Int Source # enumFrom :: Color -> [Color] Source # enumFromThen :: Color -> Color -> [Color] Source # enumFromTo :: Color -> Color -> [Color] Source # enumFromThenTo :: Color -> Color -> Color -> [Color] Source #
Eq Color |
Instance details Defined in System.Console.ANSI.Types Methods (==) :: Color -> Color -> Bool Source # (/=) :: Color -> Color -> Bool Source #
Ord Color |
Instance details Defined in System.Console.ANSI.Types Methods compare :: Color -> Color -> Ordering Source # (<) :: Color -> Color -> Bool Source # (<=) :: Color -> Color -> Bool Source # (>) :: Color -> Color -> Bool Source # (>=) :: Color -> Color -> Bool Source # max :: Color -> Color -> Color Source # min :: Color -> Color -> Color Source #
Read Color |
Instance details Defined in System.Console.ANSI.Types Methods readsPrec :: Int -> ReadS Color Source # readList :: ReadS [Color] Source # readPrec :: ReadPrec Color Source # readListPrec :: ReadPrec [Color] Source #
Show Color |
Instance details Defined in System.Console.ANSI.Types Methods showsPrec :: Int -> Color -> ShowS Source # show :: Color -> String Source # showList :: [Color] -> ShowS Source #
Ix Color |
Instance details Defined in System.Console.ANSI.Types Methods range :: (Color, Color) -> [Color] Source # index :: (Color, Color) -> Color -> Int Source # unsafeIndex :: (Color, Color) -> Color -> Int inRange :: (Color, Color) -> Color -> Bool Source # rangeSize :: (Color, Color) -> Int Source # unsafeRangeSize :: (Color, Color) -> Int

data ColorIntensity Source #

ANSI colors come in two intensities

Constructors

Dull |
Vivid |

Instances

Bounded ColorIntensity |
Instance details Defined in System.Console.ANSI.Types Methods minBound :: ColorIntensity Source # maxBound :: ColorIntensity Source #
Enum ColorIntensity |

Instance details

Defined in System.Console.ANSI.Types

Methods

succ :: ColorIntensity -> ColorIntensity Source #

pred :: ColorIntensity -> ColorIntensity Source #

toEnum :: Int -> ColorIntensity Source #

fromEnum :: ColorIntensity -> Int Source #

enumFrom :: ColorIntensity -> [ColorIntensity] Source #

enumFromThen :: ColorIntensity -> ColorIntensity -> [ColorIntensity] Source #

enumFromTo :: ColorIntensity -> ColorIntensity -> [ColorIntensity] Source #

enumFromThenTo :: ColorIntensity -> ColorIntensity -> ColorIntensity -> [ColorIntensity] Source #

Eq ColorIntensity |
Instance details Defined in System.Console.ANSI.Types Methods (==) :: ColorIntensity -> ColorIntensity -> Bool Source # (/=) :: ColorIntensity -> ColorIntensity -> Bool Source #
Ord ColorIntensity |

Instance details

Defined in System.Console.ANSI.Types

Methods

compare :: ColorIntensity -> ColorIntensity -> Ordering Source #

(<) :: ColorIntensity -> ColorIntensity -> Bool Source #

(<=) :: ColorIntensity -> ColorIntensity -> Bool Source #

(>) :: ColorIntensity -> ColorIntensity -> Bool Source #

(>=) :: ColorIntensity -> ColorIntensity -> Bool Source #

max :: ColorIntensity -> ColorIntensity -> ColorIntensity Source #

min :: ColorIntensity -> ColorIntensity -> ColorIntensity Source #

Read ColorIntensity |
Instance details Defined in System.Console.ANSI.Types Methods readsPrec :: Int -> ReadS ColorIntensity Source # readList :: ReadS [ColorIntensity] Source # readPrec :: ReadPrec ColorIntensity Source # readListPrec :: ReadPrec [ColorIntensity] Source #
Show ColorIntensity |
Instance details Defined in System.Console.ANSI.Types Methods showsPrec :: Int -> ColorIntensity -> ShowS Source # show :: ColorIntensity -> String Source # showList :: [ColorIntensity] -> ShowS Source #
Ix ColorIntensity |

Instance details

Defined in System.Console.ANSI.Types

Methods

range :: (ColorIntensity, ColorIntensity) -> [ColorIntensity] Source #

index :: (ColorIntensity, ColorIntensity) -> ColorIntensity -> Int Source #

unsafeIndex :: (ColorIntensity, ColorIntensity) -> ColorIntensity -> Int

inRange :: (ColorIntensity, ColorIntensity) -> ColorIntensity -> Bool Source #

rangeSize :: (ColorIntensity, ColorIntensity) -> Int Source #

unsafeRangeSize :: (ColorIntensity, ColorIntensity) -> Int