aboutsummaryrefslogtreecommitdiff
path: root/lib/consolecolor.nom
blob: 8184b590d811572482d073055bf9c4c26eb67872 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use "core"

%colors <- {..}
    normal:0, "reset color":0, bright:1, bold:1, dim:2, italic:3, underscore:4
    "slow blink":5, "fast blink": 6, reverse:7, inverse:7, inverted:7, hidden:8
    # There's some other codes, but they're not currently implemented
    black:30, red:31, green:32, yellow:33, blue:34, magenta:35, cyan:36, white:37
    "on black":40, "on red":41, "on green":42, "on yellow":43, "on blue":44
    "on magenta":45, "on cyan":46, "on white":47

for %name = %colornum in %colors
    with {%escapecode: "\27[\(%colornum)m"}
        run ".."
            compile [\%name] to: Lua value (quote \(quote %escapecode))
            compile [\%name %text] to
                Lua value ".."
                    (\\(quote \(quote %escapecode))..\\(%text as lua expr)..\(quote "\27[0m"))