module Ansi
( reset
, bold
, regular
, underlining
, swap
, unswap
, fgcolor
, bgcolor
, Ansi.Underlining(..)
, Ansi.ColorIntensity(..)
, Ansi.Color(..)
) where
import Data.Text (Text)
import qualified Data.Text as Text
import qualified System.Console.ANSI as Ansi
reset :: Text
reset = sgr Ansi.Reset
bold :: Text
bold = sgr (Ansi.SetConsoleIntensity Ansi.BoldIntensity)
regular :: Text
regular = sgr (Ansi.SetConsoleIntensity Ansi.NormalIntensity)
underlining :: Ansi.Underlining -> Text
underlining = sgr . Ansi.SetUnderlining
swap :: Text
swap = sgr (Ansi.SetSwapForegroundBackground True)
unswap :: Text
unswap = sgr (Ansi.SetSwapForegroundBackground False)
fgcolor :: Ansi.ColorIntensity -> Ansi.Color -> Text
fgcolor i c = sgr (Ansi.SetColor Ansi.Foreground i c)
bgcolor :: Ansi.ColorIntensity -> Ansi.Color -> Text
bgcolor i c = sgr (Ansi.SetColor Ansi.Background i c)
sgr :: Ansi.SGR -> Text
sgr = Text.pack . Ansi.setSGRCode . return