diff --git a/src/Text/ANSI.idr b/src/Text/ANSI.idr index 68920de..d9e4de1 100644 --- a/src/Text/ANSI.idr +++ b/src/Text/ANSI.idr @@ -16,21 +16,29 @@ Show DecoratedString where show dstr = escapeSGR dstr.sgr ++ dstr.str ++ escapeSGR [Reset] export -colored : Color -> String -> DecoratedString -colored c = MkDString [SetForeground c] +fromString : String -> DecoratedString +fromString = MkDString [] export -background : Color -> String -> DecoratedString -background c = MkDString [SetBackground c] +addSGR : SGR -> DecoratedString -> DecoratedString +addSGR sgr (MkDString sgrs str) = MkDString (sgr :: sgrs) str export -bolden : String -> DecoratedString -bolden = MkDString [SetStyle Bold] +colored : Color -> DecoratedString -> DecoratedString +colored c = addSGR $ SetForeground c export -italicize : String -> DecoratedString -italicize = MkDString [SetStyle Italic] +background : Color -> DecoratedString -> DecoratedString +background c = addSGR $ SetBackground c export -underline : String -> DecoratedString -underline = MkDString [SetStyle SingleUnderline] +bolden : DecoratedString -> DecoratedString +bolden = addSGR $ SetStyle Bold + +export +italicize : DecoratedString -> DecoratedString +italicize = addSGR $ SetStyle Italic + +export +underline : DecoratedString -> DecoratedString +underline = addSGR $ SetStyle SingleUnderline