0 | module Control.ANSI
 1 |
 2 | import public Control.ANSI.CSI
 3 | import public Control.ANSI.SGR
 4 |
 5 | %default total
 6 |
 7 | public export
 8 | record DecoratedString where
 9 |   constructor MkDString
10 |   sgr : List SGR
11 |   str : String
12 |
13 | export
14 | Show DecoratedString where
15 |   show dstr = escapeSGR dstr.sgr ++ dstr.str ++ escapeSGR [Reset]
16 |
17 | export
18 | colored : Color -> String -> DecoratedString
19 | colored c = MkDString [SetForeground c]
20 |
21 | export
22 | background : Color -> String -> DecoratedString
23 | background c = MkDString [SetBackground c]
24 |
25 | export
26 | bolden : String -> DecoratedString
27 | bolden = MkDString [SetStyle Bold]
28 |
29 | export
30 | italicize : String -> DecoratedString
31 | italicize = MkDString [SetStyle Italic]
32 |
33 | export
34 | underline : String -> DecoratedString
35 | underline = MkDString [SetStyle SingleUnderline]
36 |