From e89e6f835d5182e5c28b22f032fd6511f52384ab Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Thu, 4 Jan 2018 17:47:47 +0100 Subject: mless: allow overriding of colors in colorscan Fixes #81. --- mless | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'mless') 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 }' } -- cgit 1.4.1