Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Reinier Bikker <R.P.Bikker@phys.uu.nl>
To: axp-list@redhat.com
Subject: Re: setcolor equivalent
Date: Mon, 21 Aug 2000 18:01:54 +0200 (MET DST)	[thread overview]
Message-ID: <Pine.OSF.4.21.0008211759340.31626-100000@itpuu.phys.uu.nl> (raw)
In-Reply-To: <39A14F5B.C7C2F95A@appnet.com>

Another option is to use escape codes. This makes it possible to change
colors within a line of output. Below is the classic example which shows
their usage.


#!/bin/bash
# colorscript: Display ANSI colours.
#
esc="\033["
echo -n " _ _ _ _ _40 _ _ _ 41_ _ _ _42 _ _ _ 43" 
echo "_ _ _ 44_ _ _ _45 _ _ _ 46_ _ _ _47 _"
for fore in 30 31 32 33 34 35 36 37; do
  line1="$fore  " 
  line2="    "
  for back in 40 41 42 43 44 45 46 47; do
    line1="${line1}${esc}${back};${fore}m Normal  ${esc}0m"
    line2="${line2}${esc}${back};${fore};1m Bold    ${esc}0m"
  done
  echo -e "$line1\n$line2"
done


Reinier.




  reply	other threads:[~2000-08-21 16:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-08-21 14:57 setcolor equivalent Ron West
2000-08-21 15:47 ` Jeff Sturm
2000-08-21 15:48   ` Jeff Sturm
2000-08-21 16:01     ` Reinier Bikker [this message]
2000-08-21 16:18 ` Michal Jaegermann
2000-08-22 13:30 ` Peter Rye
  -- strict thread matches above, loose matches on Subject: below --
2000-08-21 15:19 Phil Carmody
2000-08-21 16:58 Ron West
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox