[comp.sys.att] 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

les@chinet.chi.il.us (Leslie Mikesell) (12/06/89)

In article <4349@cuuxb.ATT.COM> migh@cuuxb.UUCP (Mike Hall) writes:

>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

>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! :-)

But it still doesn't solve the problem that the resulting display is
exceedingly ugly.  Only the printed characters get the new background
color while the right-hand side of the screen remains black.  Is there
any way to make all of the screen which is normally black some other
color?  White-on-blue is much nicer than the standard ega/vga text.



Les Mikesell
  les@chinet.chi.il.us

palowoda@fiver.UUCP (Bob Palowoda) (12/08/89)

From article <1989Dec6.051623.22169@chinet.chi.il.us>, by les@chinet.chi.il.us (Leslie Mikesell):
> In article <4349@cuuxb.ATT.COM> migh@cuuxb.UUCP (Mike Hall) writes:
> 
> But it still doesn't solve the problem that the resulting display is
> exceedingly ugly.  Only the printed characters get the new background
> color while the right-hand side of the screen remains black.  Is there
> any way to make all of the screen which is normally black some other
> color?  White-on-blue is much nicer than the standard ega/vga text.

  Well if you have Simul-task on a system I found out you can use a 
dos program to set the pallet and character colors. When it returns 
to unix they stay that way. All the unix program I run do not reset the
color. This works with vga and some pd program I have called vpt.
The vpt program does r-g-b color mixing so you can create your own 
color mixture for the forground and background, save it in a file
and call it up. I don't know if this works for ega screens.

---Bob

-- 
Bob Palowoda  pacbell!indetech!palowoda    *Home of Fiver BBS*  login: bbs
Home {sun|daisy}!ys2!fiver!palowoda         (415)-623-8809 1200/2400
Work {sun|pyramid|decwrl}!megatest!palowoda (415)-623-8806 2400/9600/19200 TB
Voice: (415)-623-7495                        Public access UNIX XBBS   

pim@cti-software.nl (Pim Zandbergen) (12/08/89)

les@chinet.chi.il.us (Leslie Mikesell) writes:

>But it still doesn't solve the problem that the resulting display is
>exceedingly ugly.  Only the printed characters get the new background
>color while the right-hand side of the screen remains black.  Is there
>any way to make all of the screen which is normally black some other
>color?  White-on-blue is much nicer than the standard ega/vga text.

The setcolor command in SCO Xenix does just that.
Unfortunately, the escape codes this program sends
are not understood by the System V/386 console driver.
-- 
Pim Zandbergen                           domain : pim@cti-software.nl
CTI Software BV                          uucp   : uunet!mcsun!hp4nl!ctisbv!pim
Laan Copes van Cattenburch 70            phone  : +31 70 3542302
2585 GD The Hague, The Netherlands       fax    : +31 70 3512837

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

 = In article <4349@cuuxb.ATT.COM> migh@cuuxb.UUCP (Mike Hall) writes:
 = 
 = >And if you want to be more device independant, try using "tput" when
 = >	tput setb 3		# set character cell background to color 3

 = But it still doesn't solve the problem that the resulting display is
 = exceedingly ugly.  Only the printed characters get the new background
 = color while the right-hand side of the screen remains black.

Yeah, that's why I called it a "character cell background" color.

 = Is there any way to make all of the screen which is normally black some
 = other color?  White-on-blue is much nicer than the standard ega/vga text.

Well, maybe... I was rooting around in the support group's "stockroom" of
fixes (trying to find some info about the 2224 modems), and stumbled across
a "fix" for the display driver which sounds like it will do that.  Whether
or not it changes the color past the edges of the 25x80 screen I don't know.

Somehow you've gotta convince the NJ hotline to escalate the problem to Lisle
and then "inform" the support consultant of the fix.  [Boy, is _this_ ever
gonna get me in trouble!!!]

A caveat: it doesn't look like it has been sent out, so maybe they're
sitting on it for some good reason. (Then again, it looks like it's about 
a year old...)

Mike (getting in trouble, Ho, ho, ho!) Hall		att!cuuxb!migh