[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nmh-workers] colorized/highlighted scan output?

From: Paul Fox
Subject: Re: [Nmh-workers] colorized/highlighted scan output?
Date: Thu, 01 Nov 2012 21:41:02 -0400

david wrote:
 > Hi,
 > I tried adding some raw ANSI escape sequences to a scan
 > format to colorize the cur and unseen messages, and they
 > sort of work.  I get the desired effects, but scan loses
 > track of how many characters are actually displayed so there
 > are some annoyances.  They should be easy to fix.
 > But before I dig into that, does anyone have another way to
 > colorize or highlight the output from scan?

i think my usual inclination for colorization is to post-process
with sed.  i haven't done it with scan output, but i do it
with a couple of different mail perusing scripts i've written.

leaving out the details, something like this:

        RED="$(printf \\033[1\;31m)"
        GREEN="$(printf \\033[1\;32m)"
        YELLOW="$(printf \\033[1\;33m)"
        BLUE="$(printf \\033[1\;34m)"
        PURPLE="$(printf \\033[1\;35m)"
        CYAN="$(printf \\033[1\;36m)"
        BOLD="$(printf \\033[1m)"
        NORMAL="$(printf \\033[m)"
        ESC="$(printf \\033)"

    # make the Subject: and From: text stand out in red and blue
        sed \
            -e 's/^\(Subject: *\)\(.*\)/\1'"$RED"'\2'"$NORMAL"'/' \
            -e 's/^\(From: *\)\(.*\)/\1'"$BLUE"'\2'"$NORMAL"'/'

    mhshow $msg | colorize

i guess you'd have to use a scan format which tagged the line,
and then sed might have to untag them as well as colorize them.

 paul fox, address@hidden (arlington, ma, where it's 44.2 degrees)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]