[comp.unix.questions] Escape codes and colors in AT+T SysV.

jessea@dynasys.UUCP (Jesse W. Asher) (12/03/89)

I recently installed AT+T Unix SysV/386 3.2 and read in the manual how
you can change the screen attributes through escape codes.  I have no idea
how these work, however, and the manual only said that you use the unix escape
sequence ([) and then the qualifier.  I've tried various ways and none seem
to work.  Another aspect I'm interested in is changing the background and
foreground colors.  I'm tired of black and white.  Can anyone out there explain
how this works?  Thanx in advance for any help.


-- 
Jesse W. Asher - Dynasys - (901)382-1705       Internet: jessea@dynasys.UU.NET 
6196-1 Macon Rd., Suite 200, Memphis, TN 38134     UUCP: uunet!dynasys!jessea 

cpcahil@virtech.uucp (Conor P. Cahill) (12/03/89)

In article <8@dynasys.UUCP>, jessea@dynasys.UUCP (Jesse W. Asher) writes:
> I recently installed AT+T Unix SysV/386 3.2 and read in the manual how
> you can change the screen attributes through escape codes.  I have no idea
> how these work, however, and the manual only said that you use the unix escape
> sequence ([) and then the qualifier.  I've tried various ways and none seem
> to work.  Another aspect I'm interested in is changing the background and
> foreground colors.  I'm tired of black and white.  Can anyone out there explain
> how this works?  Thanx in advance for any help.

You can do this from the shell (or your .profile) with the following:

	echo "\033[XXm" 

Where

	XX is the color/attribute specification.  See display(7) for a 
	complete list of what colors and/or attributes can be used.

While this does work at setting the color attributes, it does not
provide a satisfactory implementation because it doesn't cause the entire
screen to be colored.  Only characters output after that sequence are in
the specified color.  Another problem is that many programs (like vi) clear
the color/attributes by sending an \033[0m at startup time.

Most of the time people set thier colors in the shell command prompt so that
the colors are set/restored each time the prompt is displayed.
-- 
+-----------------------------------------------------------------------+
| Conor P. Cahill     uunet!virtech!cpcahil      	703-430-9247	!
| Virtual Technologies Inc.,    P. O. Box 876,   Sterling, VA 22170     |
+-----------------------------------------------------------------------+

tneff@bfmny0.UU.NET (Tom Neff) (12/03/89)

In article <1989Dec3.025200.26143@virtech.uucp> cpcahil@virtech.uucp (Conor P. Cahill) writes:
>While this does work at setting the color attributes, it does not
>provide a satisfactory implementation because it doesn't cause the entire
>screen to be colored.  Only characters output after that sequence are in
>the specified color.  Another problem is that many programs (like vi) clear
>the color/attributes by sending an \033[0m at startup time.

Actually no, programs like vi(1) clear the color/attributes by sending
whatever TERMINFO tells them does the trick for your selected terminal!
Therein lies the real trick for getting a different colored console:
define an alternative AT386 entry with the colors you want specified by
twiddling the startup sequences.  The underlying AT_ANSI display driver
is a generic color terminal that's happy to use whatever colors you ask.
This really works; I also use it to run a 43 line console which is the
joy of my existence.
-- 
War is like love; it always      \%\%\%   Tom Neff
finds a way. -- Bertold Brecht   %\%\%\   tneff@bfmny0.UU.NET

migh@cuuxb.ATT.COM (~XT6561110~Mike Hall~C24~M26a~6029~) (12/05/89)

 = From: cpcahil@virtech.uucp (Conor P. Cahill)
 = You can do this from the shell (or your .profile) with the following:
 = 	echo "\033[XXm" 

And if you want to be more device independant, try using "tput" when
your TERM variable is set to "AT386", instead of "AT386-M" .  Like this:

	TERM=AT386 export TERM
	tput setb 3		# set character cell background to color 3
	tput setf 4		# set character cell foreground to color 4
And here's a handy one:
	tput clear		# clear the screen, home to upper left

With luck, two years from now, these will still work on your 2000x2000,
1024 color display, and you won't have to remember the escape sequences
for it! :-)

Mike Hall	att!cuuxb!migh