Copyright | Daniel Mendler (c) 2017 |
---|---|
License | MIT (see the file LICENSE) |
Maintainer | mail@daniel-mendler.de |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe |
Language | Haskell2010 |
- data Colored a
- data Style
- data Color
- data Term
- hGetTerm :: Handle -> IO Term
- getTerm :: IO Term
- hPrintColored :: Foldable f => (Handle -> a -> IO ()) -> Handle -> Term -> f (Colored a) -> IO ()
- printColored :: Foldable f => (a -> IO ()) -> Term -> f (Colored a) -> IO ()
- hPrintColoredIO :: Handle -> Term -> [Colored (IO ())] -> IO ()
- printColoredIO :: Term -> [Colored (IO ())] -> IO ()
- hPrintColoredS :: Foldable f => Handle -> Term -> f (Colored String) -> IO ()
- printColoredS :: Foldable f => Term -> f (Colored String) -> IO ()
- showColored :: (Foldable f, Monoid o) => (a -> o) -> (SGRCode -> o) -> Term -> f (Colored a) -> o
- showColoredM :: (Foldable f, Monad m, Monoid o) => (a -> m o) -> (SGRCode -> m o) -> Term -> f (Colored a) -> m o
- showColoredS :: Foldable f => Term -> f (Colored String) -> ShowS
- (<>) :: Semigroup a => a -> a -> a
Colored datatypes
Rendering style
Named colors, 256 and RGB colors for more capable terminals.
DefaultColor | Default terminal color (terminal specific) |
Black | |
Red | |
Green | |
Yellow | |
Blue | |
Magenta | |
Cyan | |
White | |
DullBlack | |
DullRed | |
DullGreen | |
DullYellow | |
DullBlue | |
DullMagenta | |
DullCyan | |
DullWhite | |
Color256 !Word8 | Color from 256 color scheme. Color is automatically reduced to 8 colors for less capable terminals. |
RGB !Word8 !Word8 !Word8 | True color. Color is automatically reduced to 256 or 8 colors for less capable terminals. |
Terminal type
Terminal type. For less capable terminals the color depth is automatically reduced.
hGetTerm :: Handle -> IO Term Source #
The action (hGetTerm handle)
determines the terminal type of the file handle
.
The terminal type is determined by checking if the file handle points to a device
and by looking at the $TERM
environment variable.
Colorful printing to file handle
hPrintColored :: Foldable f => (Handle -> a -> IO ()) -> Handle -> Term -> f (Colored a) -> IO () Source #
Show with ANSI escape sequences
showColored :: (Foldable f, Monoid o) => (a -> o) -> (SGRCode -> o) -> Term -> f (Colored a) -> o Source #
showColoredM :: (Foldable f, Monad m, Monoid o) => (a -> m o) -> (SGRCode -> m o) -> Term -> f (Colored a) -> m o Source #