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 :: (Handle -> a -> IO ()) -> Handle -> Term -> [Colored a] -> IO ()
- printColored :: (a -> IO ()) -> Term -> [Colored a] -> IO ()
- hPrintColoredIO :: Handle -> Term -> [Colored (IO ())] -> IO ()
- printColoredIO :: Term -> [Colored (IO ())] -> IO ()
- hPrintColoredS :: Handle -> Term -> [Colored String] -> IO ()
- printColoredS :: Term -> [Colored String] -> IO ()
- showColored :: Monoid o => (a -> o) -> (SGRCode -> o) -> Term -> [Colored a] -> o
- showColoredA :: (Applicative f, Monoid o) => (a -> f o) -> (SGRCode -> f o) -> Term -> [Colored a] -> f o
- showColoredS :: Term -> [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
Show with ANSI escape sequences
showColoredA :: (Applicative f, Monoid o) => (a -> f o) -> (SGRCode -> f o) -> Term -> [Colored a] -> f o Source #