*BSD News Article 3976


Return to BSD News archive

Newsgroups: comp.unix.bsd
Path: sserve!manuel!munnari.oz.au!uunet!mcsun!sunic!ugle.unit.no!lise.unit.no!arnej
From: arnej@Lise.Unit.NO (Arne Henrik Juul)
Subject: Re: 386bsd: 16550, color, vt100
Message-ID: <1992Aug20.222741.9968@ugle.unit.no>
Sender: news@ugle.unit.no (NetNews Administrator)
Reply-To: arnej@lise.unit.no
Organization: Norwegian Institute of Technology
References: <1992Aug19.195743.13499@engage.pko.dec.com> <sand.714341461@milton>
Date: Thu, 20 Aug 92 22:27:41 GMT
Lines: 69

In article <sand.714341461@milton>, sand@milton.u.washington.edu (Derek Upham) writes:
 > eje@irenaeus.mlo.dec.com (Eric James Ewanco) writes:
 > 
 > >Second: Is there any way to change the text color to green? I hate
 > >white.  Will ANSI colors work?
 > 
 > Check out /etc/rc.  It has escape sequences that change the color at
 > boot time.  You should be able to fiddle with them and put something
 > in /etc/rc.local.

You can do it from the command line. Use Cntrl-V ESC to insert a literal
escape (echoed as  ^{ ).

% echo '^{[3;30x'      -> yellow foreground, blue background                
% echo '^{[14;1r'        -> set standout mode to yellow foreground,
                          blue background 

The sequence:   ESC [ 3 ; <number> x
means: set the PC color mode to <number>, where <number> will be used
in this way:

|   7   |   6   |   5   |   4   |   3   |   2   |   1   |   0   |
| blink |      background       |bright |      foreground       |
| (fg)  |         color         | (fg)  |         color         |



Colors:

 black      0       0       0               0       0       0   |    0, 0
 blue       0       0       1               0       0       1   |   16, 1
 green      0       1       0               0       1       0   |   32, 2
 cyan       0       1       1               0       1       1   |   48, 3
 red        1       0       0               1       0       0   |   64, 4
 magenta    1       0       1               1       0       1   |   80, 5
 brown      1       1       0               1       1       0   |   96, 6
 white      1       1       1               1       1       1   |  112, 7

 gray                               1       0       0       0   |       8
 light blue                         1       0       0       1   |       9
 light green                        1       0       1       0   |      10
 light cyan                         1       0       1       1   |      11
 ligth red                          1       1       0       0   |      12
 ligth magenta                      1       1       0       1   |      13
 yellow                             1       1       1       0   |      14
 bright white                       1       1       1       1   |      15



So, for example, blinking yellow foreground on brown background is:
128 (blink) + 14 (yellow foreground) + 96 (brown backgroun) = 238


The standout mode works another way: Here, the foreground is given
first (as a number from 0-15) followed by background as another number
from 0-15. The same color combination would be:

 fg = 14
 bg = (128 + 96) >> 4 = 14

So you would use "ESC [ 14 ; 14 r".


OK, I hope this was understandable for everyone, it was mostly found
with hit-and-miss tactics :-)


--
Arne H. Juul  --  arnej@lise.unit.no  --  University of Trondheim, Norway