about summary refs log tree commit diff
path: root/mless
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2018-01-04 17:47:47 +0100
committerLeah Neukirchen <leah@vuxu.org>2018-01-04 17:47:47 +0100
commite89e6f835d5182e5c28b22f032fd6511f52384ab (patch)
tree338d7474f026ea2de79058648bbd3c761bcf114c /mless
parentaf7d6750fd5d138914cf05f17836b3f87d2e880f (diff)
downloadmblaze-e89e6f835d5182e5c28b22f032fd6511f52384ab.tar.gz
mblaze-e89e6f835d5182e5c28b22f032fd6511f52384ab.tar.xz
mblaze-e89e6f835d5182e5c28b22f032fd6511f52384ab.zip
mless: allow overriding of colors in colorscan
Fixes #81.
Diffstat (limited to 'mless')
-rwxr-xr-xmless5
1 files changed, 3 insertions, 2 deletions
diff --git a/mless b/mless
index 16e82d1..8a94d34 100755
--- a/mless
+++ b/mless
@@ -5,10 +5,11 @@ PATH="${0%/*}:$PATH"
 
 colorscan() {
 awk '
+function co(n, c) { e = ENVIRON["MCOLOR_" n]; return e ? e : c }
 function fg(c, s) { return sprintf("\033[38;5;%03dm%s\033[0m", c, s) }
 function so(s) { return sprintf("\033[1m%s\033[0m", s) }
-/^>/ { print so(fg(119, $0)); next }
-/^ *\\_/ { print fg(242, $0); next }
+/^>/ { print so(fg(co("CUR",119), $0)); next }
+/^ *\\_/ { print fg(co("MISS",242), $0); next }
 { print }'
 }