diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2019-01-29 16:16:45 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2019-01-29 16:17:33 -0800 |
| commit | bc41cc3a244bf47679d1c47d17006a2aa7356bc8 (patch) | |
| tree | 102ec25b54f795d7a24648faa129f4dbccef3619 /lib/consolecolor/init.nom | |
| parent | febe7e82e06e1071c312f449b1ced319ef9a6932 (diff) | |
Switched to have colors/utf8 be optional, fixed an issue with currently
running files leaking when errors occurred (causing spurious circular
import errors), and improved tutorial.
Diffstat (limited to 'lib/consolecolor/init.nom')
| -rw-r--r-- | lib/consolecolor/init.nom | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/consolecolor/init.nom b/lib/consolecolor/init.nom index 27823b8..606f4b6 100644 --- a/lib/consolecolor/init.nom +++ b/lib/consolecolor/init.nom @@ -17,9 +17,12 @@ $colors = { } for $name = $colornum in $colors: - $colornum = "\$colornum" - \($name \$text) compiles to: - if $text: - return (Lua "('\\027[\($colornum)m'..\($text as lua expr)..'\\027[0m')") - ..else: - return (Lua "'\\027[\($colornum)m'") + (nomsu environment).($name, as lua id) = + for $text: + if $(COLOR ENABLED): + if $text: + return "\x1B[\($colornum)m\$text\x1b[0m" + ..else: + return "\x1B[\($colornum)m" + ..else: + return ($text or "") |
