Copyright | (c) 2020 Kowainik |
---|---|
License | MPL-2.0 |
Maintainer | Kowainik <xrom.xkov@gmail.com> |
Safe Haskell | None |
Language | Haskell2010 |
This module introduces helpful pure codes to customise the terminal output view.
Synopsis
- formatWith :: (IsString str, Semigroup str) => [str] -> str -> str
- red :: IsString str => str
- green :: IsString str => str
- blue :: IsString str => str
- yellow :: IsString str => str
- black :: IsString str => str
- white :: IsString str => str
- magenta :: IsString str => str
- cyan :: IsString str => str
- redBg :: IsString str => str
- greenBg :: IsString str => str
- blueBg :: IsString str => str
- yellowBg :: IsString str => str
- blackBg :: IsString str => str
- whiteBg :: IsString str => str
- magentaBg :: IsString str => str
- cyanBg :: IsString str => str
- bold :: IsString str => str
- italic :: IsString str => str
- underline :: IsString str => str
- doubleUnderline :: IsString str => str
- noUnderline :: IsString str => str
- indent :: (IsString str, Semigroup str) => Int -> str
- reset :: IsString str => str
Documentation
formatWith :: (IsString str, Semigroup str) => [str] -> str -> str Source #
General purpose function to format strings with multiple options. If this function takes empty list as an argument, no formatting is applied.
Some typical usages include but not limited to:
- Green text:
formatWith
[green
] myString - Bold red text:
formatWith
[bold
,red
] myString - Blue text on white background:
formatWith
[blue
,whiteBg
] myString - Italicized yellow on cyan background:
formatWith
[italic
,yellow
,cyanBg
] myString
⚠ Caution: Double underlining doubleUnderline
is not widely supported.
It is also not natively supported on Windows 10.
Colour
Background
redBg :: IsString str => str Source #
Code to apply Red
background colouring for the terminal output.
greenBg :: IsString str => str Source #
Code to apply Green
background colouring for the terminal output.
blueBg :: IsString str => str Source #
Code to apply Blue
background colouring for the terminal output.
yellowBg :: IsString str => str Source #
Code to apply Yellow
background colouring for the terminal output.
blackBg :: IsString str => str Source #
Code to apply Black
background colouring for the terminal output.
whiteBg :: IsString str => str Source #
Code to apply White
background colouring for the terminal output.
magentaBg :: IsString str => str Source #
Code to apply Magenta
background colouring for the terminal output.
cyanBg :: IsString str => str Source #
Code to apply Cyan
background colouring for the terminal output.
Emphasis
doubleUnderline :: IsString str => str Source #
Code to apply double underline emphasis for the terminal output.
⚠ Caution: This is not widely supported. It is not natively supported on Windows 10
noUnderline :: IsString str => str Source #
Code to apply no underline emphasis for the terminal output.
indent :: (IsString str, Semigroup str) => Int -> str Source #
Code to indent the terminal output by the given amount of spaces.