aboutsummaryrefslogtreecommitdiff
path: root/lib/consolecolor
diff options
context:
space:
mode:
Diffstat (limited to 'lib/consolecolor')
-rw-r--r--lib/consolecolor/init.nom15
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 "")