Safe Haskell | Safe-Inferred |
---|
A simple Styled Text implementation. There are a few others on hackage (terminal-text, rainbow, ...), but they're all too complicated for me.
Examples: > printLn $ fgs (bright red) "hi" <> fgs red "there" > printLn $ bgs (bright red) "hi" <> bgs red "there" > printLn $ underlines "hi" <> " " <> bolds "there" > printLn $ underlines $ fgs (bright red) "hi" <> fgs red "there"
printLn $ bgs cyan "hello\nthere" printLn $ bgs cyan "hello" <> "\n" <> bgs cyan "there"
Synopsis
- data Styled
- data Style = Style {
- _foreground :: !(Maybe.Maybe Color)
- _background :: !(Maybe.Maybe Color)
- _bold :: !Bool
- _underline :: !Bool
- print :: Styled -> IO ()
- printLn :: Styled -> IO ()
- toByteString :: Styled -> ByteString
- toByteStrings :: Styled -> [ByteString]
- toText :: Styled -> Text
- toTexts :: Styled -> [Text]
- data Color
- data RgbColor
- data AnsiColor
- black :: Color
- red :: Color
- green :: Color
- yellow :: Color
- blue :: Color
- magenta :: Color
- cyan :: Color
- white :: Color
- rgb :: Float -> Float -> Float -> Color
- rgbGray :: Float -> Color
- rgbColor :: Float -> Float -> Float -> RgbColor
- toRgb :: RgbColor -> (Float, Float, Float)
- styled :: ToStyled a => Style -> a -> Styled
- plain :: Text -> Styled
- bright :: Color -> Color
- fgs :: Color -> Styled -> Styled
- bgs :: Color -> Styled -> Styled
- bolds :: Styled -> Styled
- underlines :: Styled -> Styled
- fg :: ToStyled a => Color -> a -> Styled
- bg :: ToStyled a => Color -> a -> Styled
- bold :: ToStyled a => a -> Styled
- underline :: ToStyled a => a -> Styled
- join :: Styled -> [Styled] -> Styled
- toHtml :: Styled -> Html.Html
- toHtmls :: Styled -> [Html.Html]
- styleHtml :: Style -> Html.Html -> Html.Html
Documentation
Style | |
|
toByteString :: Styled -> ByteString Source #
toByteStrings :: Styled -> [ByteString] Source #
underlines :: Styled -> Styled Source #