Improved random colors, (was 7 colors, now 21), inspired by a reading
of the "control characters" section of 'man console_codes':

        # print the words of a sentence in three shades of random colors
        S="the quick brown fox jumps over the lazy dog."
        L=`echo $S | wc -w`     # word count of $S
        for f in 1 2 22 ; do seq -f "$f;%g" 31 37 ; done | rl -rc $L | for f in 
$S ; do read c ; /bin/echo -ne "\033[40;$c\155$f " ; done ; echo -e 
"\033[39;49\155"

How it works:  the first 'for...done' loop prints the 21 possible color
codes over a black background, 'rl' grabs $L of those at random, then
the second 'for' loop prints the words in $S using those random
colors.  The last 'echo' restores the default colors.

'man rl' in color, (sans formatting):

        man rl | while read S ; do [ "$S" ] || { echo ; continue ; } ; L=`echo 
$S | wc -w` ; for f in 1 2 22 ; do seq -f "$f;%g" 31 37 ; done | rl -rc $L | 
for f in $S ; do read c ; /bin/echo -ne "\033[40;$c\155$f " ; done ; echo -e 
"\033[39;49\155"; done

The 'seq' stuff within the while loop is wasteful, it's just a
demo.  This can be piped to 'less -R', which shows color.  First
piping text to 'dog --krad' ups the nonsense level.


HTH...


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to