Discussion:
[UnixOS2] termcap colours
John Poltorak
2004-05-01 18:36:37 UTC
Permalink
I have never really understood how to use termcap properly...

I know you need to set a value for term such as ANSI, but isn't this just
for terminal type? Can't I use ANSI but still have cyan text on a blue
background? I have to change terminal type to ANSI-COLOR-2 if I want
different colours, but this doesn't seem to be the best way of doing
things.
--
John
Thomas Dickey
2004-05-01 18:46:49 UTC
Permalink
Post by John Poltorak
I have never really understood how to use termcap properly...
I know you need to set a value for term such as ANSI, but isn't this just
for terminal type? Can't I use ANSI but still have cyan text on a blue
background? I have to change terminal type to ANSI-COLOR-2 if I want
different colours, but this doesn't seem to be the best way of doing
things.
it's not. the termcap (or terminfo) tells an application how to set
colors, but doesn't (really) force the screen to be a particular color,
since other applications may reset them.
--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net
John Poltorak
2004-05-01 18:53:18 UTC
Permalink
Post by Thomas Dickey
Post by John Poltorak
I have never really understood how to use termcap properly...
I know you need to set a value for term such as ANSI, but isn't this just
for terminal type? Can't I use ANSI but still have cyan text on a blue
background? I have to change terminal type to ANSI-COLOR-2 if I want
different colours, but this doesn't seem to be the best way of doing
things.
it's not. the termcap (or terminfo) tells an application how to set
colors, but doesn't (really) force the screen to be a particular color,
since other applications may reset them.
So how do I set the colours I want?

If I use TERM=ANSI from termcap.x11 I get an awfull brown coloured
background with black text. Can I change this without altering terminal
type?
Post by Thomas Dickey
--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net
--
John
Andreas Buening
2004-05-01 19:42:34 UTC
Permalink
This post might be inappropriate. Click to display it.
Thomas Dickey
2004-05-01 22:43:42 UTC
Permalink
Post by Andreas Buening
Sure. You can set background color, foreground color,
color for highlightning ...
Long time ago I wrote an os2 console definition that uses
blue for background but I don't remember which command means
o2|os2|OS/2 ANSI console:\
:co#80:li#25:bs:pt:am:bl=^G:le=^H:do=^J:ta=^I:\
:cl=\E[H\E[2J:ce=\E[K:\
:sc=\E[s:rc=\E[u\:\
:ho=\E[H:cm=\E[%i%d;%dH:\
:up=\E[A:do=\E[B:le=\E[C:ri=\E[D:nd=\E[C:\
:ti=\E[0;37;44m\E[=7l:te=\E[0m\E[=7h\E[1B\E[K\E[1A:\
^^^^^^^^^^^ (white-on-blue)
^^^^^ (may reset colors to white-on-black)

ti and te are normally sent by vi when beginning/ending the screen mode.
Post by Andreas Buening
:kl=\EOD:kr=\EOC:ku=\EOA:kd=\EOB:\
:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k5=\EOT:\
:k6=\EOU:k7=\EOV:k8=\EOW:k9=\EOX:k0=\EOY:\
:kh=\E]7:kH=\E]1:\
:kE=\E[K:kN=\E]3:kP=\E]9:kF=\E]c2:kR=\E]c8:\
^^^^^^^^^^^^^^^ (my keyboard doesn't send these for
pageup/pagedown).
Post by Andreas Buening
Bye,
Andreas
--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net
Andreas Buening
2004-05-02 11:14:18 UTC
Permalink
Post by Thomas Dickey
Post by Andreas Buening
:ti=\E[0;37;44m\E[=7l:te=\E[0m\E[=7h\E[1B\E[K\E[1A:\
^^^^^^^^^^^ (white-on-blue)
That's true. I prefer blue background.
Post by Thomas Dickey
^^^^^ (may reset colors to white-on-black)
Yes, it does.
Post by Thomas Dickey
ti and te are normally sent by vi when beginning/ending the screen mode.
Also by less and info, I guess.
Post by Thomas Dickey
Post by Andreas Buening
:kE=\E[K:kN=\E]3:kP=\E]9:kF=\E]c2:kR=\E]c8:\
^^^^^^^^^^^^^^^ (my keyboard doesn't send these for
pageup/pagedown).
No idea. What would be the correct keys?


Bye,
Andreas
Thomas Dickey
2004-05-02 12:55:32 UTC
Permalink
Post by Andreas Buening
Post by Thomas Dickey
Post by Andreas Buening
:ti=\E[0;37;44m\E[=7l:te=\E[0m\E[=7h\E[1B\E[K\E[1A:\
^^^^^^^^^^^ (white-on-blue)
That's true. I prefer blue background.
Post by Thomas Dickey
^^^^^ (may reset colors to white-on-black)
Yes, it does.
Then (as I understand the entry), you have blue background when running
vi, less and info, but white-on-black when doing ls and other ordinary
shell commands. My impression of John Polterak's question was that he
wanted a colored background all the time (which is harder to guarantee).
Post by Andreas Buening
Post by Thomas Dickey
ti and te are normally sent by vi when beginning/ending the screen mode.
Also by less and info, I guess.
Post by Thomas Dickey
Post by Andreas Buening
:kE=\E[K:kN=\E]3:kP=\E]9:kF=\E]c2:kR=\E]c8:\
^^^^^^^^^^^^^^^ (my keyboard doesn't send these for
pageup/pagedown).
No idea. What would be the correct keys?
I have this (from entries I built/tested):

emx-base|DOS special keys:\
:am:bw:mi:ms:xo:\
:co#80:it#8:li#25:\
:K1=\0G:K2=\0L:K3=\0I:K4=\0O:K5=\0Q:ae=\E[10m:as=\E[11m:\
:bl=^G:ce=\E[K:cl=\E[2J:cm=\E[%i%d;%dH:do=\E[B:ho=\E[H:\
:is=\E[m\E[?7h:k1=\0;:k2=\0<:k3=\0=:k4=\0>:k5=\0?:k6=\0@:\
:k7=\0A:k8=\0B:k9=\0C:kD=\0S:kI=\0R:kN=\0Q:kP=\0I:kb=^H:\
:kd=\0P:kh=\0G:kl=\0K:kr=\0M:ku=\0H:le=^H:mb=\E[5m:md=\E[1m:\
:me=\E[0;10m:mr=\E[7m:nd=\E[C:rc=\E[u:sc=\E[s:se=\E[m:\
:so=\E[7m:ue=\E[m:up=\E[A:us=\E[4m:

which uses \0Q (null followed by Q) and \0I (null followed by I).
terminfo stores those nulls internally as \200. I'm not sure what
the termcap functions on OS/2 EMX do.
--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net
Andreas Buening
2004-05-02 13:59:37 UTC
Permalink
Thomas Dickey wrote:

[termcap]
Post by Thomas Dickey
Then (as I understand the entry), you have blue background when running
vi, less and info, but white-on-black when doing ls and other ordinary
shell commands. My impression of John Polterak's question was that he
wanted a colored background all the time (which is harder to guarantee).
Hmm, for this he could set his preferred colors in %PROMPT%.
Post by Thomas Dickey
which uses \0Q (null followed by Q) and \0I (null followed by I).
terminfo stores those nulls internally as \200. I'm not sure what
the termcap functions on OS/2 EMX do.
The comments in my termcap.dat say:

# PageDown |\E[3 |Next page
# PageUp |\E[9 |Previous page

Neither do I know what key \E[3 nor \0Q is supposed to be.


Bye,
Andreas
John Poltorak
2004-05-03 11:17:17 UTC
Permalink
Post by Thomas Dickey
Post by Andreas Buening
Post by Thomas Dickey
Post by Andreas Buening
:ti=\E[0;37;44m\E[=7l:te=\E[0m\E[=7h\E[1B\E[K\E[1A:\
^^^^^^^^^^^ (white-on-blue)
That's true. I prefer blue background.
Post by Thomas Dickey
^^^^^ (may reset colors to white-on-black)
Yes, it does.
Then (as I understand the entry), you have blue background when running
vi, less and info, but white-on-black when doing ls and other ordinary
shell commands. My impression of John Polterak's question was that he
wanted a colored background all the time (which is harder to guarantee).
No - not necessarily. I just wondered if there was a simply utility for
amending colours for a particular term type without being exposed to the
arcane termcap configuration. ie something which could be used to
translate those entries into a human readable form.
Post by Thomas Dickey
Post by Andreas Buening
Post by Thomas Dickey
ti and te are normally sent by vi when beginning/ending the screen mode.
Also by less and info, I guess.
Post by Thomas Dickey
Post by Andreas Buening
:kE=\E[K:kN=\E]3:kP=\E]9:kF=\E]c2:kR=\E]c8:\
^^^^^^^^^^^^^^^ (my keyboard doesn't send these for
pageup/pagedown).
No idea. What would be the correct keys?
emx-base|DOS special keys:\
:am:bw:mi:ms:xo:\
:co#80:it#8:li#25:\
:K1=\0G:K2=\0L:K3=\0I:K4=\0O:K5=\0Q:ae=\E[10m:as=\E[11m:\
:bl=^G:ce=\E[K:cl=\E[2J:cm=\E[%i%d;%dH:do=\E[B:ho=\E[H:\
:k7=\0A:k8=\0B:k9=\0C:kD=\0S:kI=\0R:kN=\0Q:kP=\0I:kb=^H:\
:kd=\0P:kh=\0G:kl=\0K:kr=\0M:ku=\0H:le=^H:mb=\E[5m:md=\E[1m:\
:me=\E[0;10m:mr=\E[7m:nd=\E[C:rc=\E[u:sc=\E[s:se=\E[m:\
which uses \0Q (null followed by Q) and \0I (null followed by I).
terminfo stores those nulls internally as \200. I'm not sure what
the termcap functions on OS/2 EMX do.
I'm not sure if anyone else does either. I was just wondering if other
platforms have the same awful colours for ANSI as we do on OS/2...


I would like to extract a standard termcap file from termcap v1.3.1 but am
unsure about how to do this. Is it simply a matter of running make from
that archive?
Post by Thomas Dickey
--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net
--
John
Thomas Dickey
2004-05-03 11:55:27 UTC
Permalink
Post by John Poltorak
I'm not sure if anyone else does either. I was just wondering if other
platforms have the same awful colours for ANSI as we do on OS/2...
The default console window for cygwin on M$ uses dull foreground on black.
But on that platform I set the default palette to use white background,
which is more readable.

After my previous response I checked the OS/2 windows, don't see an
obvious place to apply any color palette changes - so perhaps tinkering
with the termcap is the only way to do this. I put on my to-do list an
item to make nicer versions of some of the EMX terminfo entries).
Post by John Poltorak
I would like to extract a standard termcap file from termcap v1.3.1 but am
unsure about how to do this. Is it simply a matter of running make from
that archive?
That doesn't contain any of the EMX types that you're discussing.
There's an emx.src in ncurses which contains the (some corrections)
terminfo version of the termcap.dat that you're using.
--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net
John Poltorak
2004-05-03 13:06:25 UTC
Permalink
Post by Thomas Dickey
Post by John Poltorak
I'm not sure if anyone else does either. I was just wondering if other
platforms have the same awful colours for ANSI as we do on OS/2...
The default console window for cygwin on M$ uses dull foreground on black.
But on that platform I set the default palette to use white background,
which is more readable.
How would I go about using the term used by cygwin?
Post by Thomas Dickey
After my previous response I checked the OS/2 windows, don't see an
obvious place to apply any color palette changes - so perhaps tinkering
with the termcap is the only way to do this. I put on my to-do list an
item to make nicer versions of some of the EMX terminfo entries).
Post by John Poltorak
I would like to extract a standard termcap file from termcap v1.3.1 but am
unsure about how to do this. Is it simply a matter of running make from
that archive?
That doesn't contain any of the EMX types that you're discussing.
I have no real idea what is special about any of the EMX types. Do we need
any of them. Isn't is possible to use a standard ANSI term on OS/2?
Post by Thomas Dickey
There's an emx.src in ncurses which contains the (some corrections)
terminfo version of the termcap.dat that you're using.
Yes, I've often wondered what that was for. Is there any documentation on
what it provides or what uses it?
Post by Thomas Dickey
--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net
--
John
Thomas Dickey
2004-05-03 13:29:23 UTC
Permalink
Post by John Poltorak
Post by Thomas Dickey
Post by John Poltorak
I'm not sure if anyone else does either. I was just wondering if other
platforms have the same awful colours for ANSI as we do on OS/2...
The default console window for cygwin on M$ uses dull foreground on black.
But on that platform I set the default palette to use white background,
which is more readable.
How would I go about using the term used by cygwin?
The console window itself is win32-specific. To set the $TERM value,
you only need an appropriate termcap. You can generate a termcap from
terminfo using ncurses, e.g.,
infocmp -Cr cygwin >foo
Post by John Poltorak
I have no real idea what is special about any of the EMX types. Do we need
any of them. Isn't is possible to use a standard ANSI term on OS/2?
You "could". But "ansi" applies to a number of different terminal types.
The entries in EMX's termcap.dat don't exactly match the usage from
other systems. Aside from (a few years ago) updating the entries in
ncurses' terminfo.src that refer to "emx", I don't recall anything else
that can be done. When I'm using OS/2, I don't often use the termcap.dat
Post by John Poltorak
Post by Thomas Dickey
There's an emx.src in ncurses which contains the (some corrections)
terminfo version of the termcap.dat that you're using.
Yes, I've often wondered what that was for. Is there any documentation on
what it provides or what uses it?
not really - I started with a copy of termcap.dat, added missing
definitions (wrote some comments, but not anything extensive).
--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net
John Poltorak
2004-05-03 13:46:45 UTC
Permalink
Post by Thomas Dickey
Post by John Poltorak
How would I go about using the term used by cygwin?
The console window itself is win32-specific. To set the $TERM value,
you only need an appropriate termcap. You can generate a termcap from
terminfo using ncurses, e.g.,
infocmp -Cr cygwin >foo
Thanks I'll give that a try.
Post by Thomas Dickey
Post by John Poltorak
I have no real idea what is special about any of the EMX types. Do we need
any of them. Isn't is possible to use a standard ANSI term on OS/2?
You "could". But "ansi" applies to a number of different terminal types.
The entries in EMX's termcap.dat don't exactly match the usage from
other systems. Aside from (a few years ago) updating the entries in
ncurses' terminfo.src that refer to "emx", I don't recall anything else
that can be done. When I'm using OS/2, I don't often use the termcap.dat
I thought some apps such as emacs or info required the use of a
termcap.dat of some sort.

I'm still pretty hazy about which apps use termcap and which use terminfo.

If TERM=ANSI is defined and ansi appears in both termcap and terminfo, how
do I know which is being used and can either be used? In any case aren't
they derived from the same source?
Post by Thomas Dickey
--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net
--
John
Thomas Dickey
2004-05-03 14:53:03 UTC
Permalink
This post might be inappropriate. Click to display it.
Thomas Dickey
2004-05-01 19:48:19 UTC
Permalink
Post by John Poltorak
So how do I set the colours I want?
If I use TERM=ANSI from termcap.x11 I get an awfull brown coloured
background with black text. Can I change this without altering terminal
type?
I've noticed that. It was probably what looked ok for contrast, given
that OS/2 console windows don't have very bright colors. You're probably
talking about this entry:

ansi|ANSI.SYS color:\
:co#80:li#25:bs:pt:bl=^G:le=^H:do=^J:\
:cl=\E[H\E[2J:ce=\E[K:\
:ho=\E[H:cm=\E[%i%d;%dH:\
:up=\E[A:do=\E[B:le=\E[C:ri=\E[D:nd=\E[C:\
:ti=\E[0;30;43m\E[=7l:te=\E[0m\E[=7h:\
:so=\E[1;37;43m:se=\E[0;30;43m:\
:us=\E[1;31;43m:ue=\E[0;30;43m:\
:mb=\E[5m:md=\E[1;37;43m:\
:mr=\E[1;37;43m:me=\E[0;30;43m:\
:aw:

The so/se/us/ue/mr/me strings all are using color. The 43 is brown
(non-bright-yellow) background. "me" is the string that a reset does, so
normally you have black text on a brown background. If you don't set the
background in that manner, OS/2 windows default to white text on black
background (which happens to be what I normally use on Linux, while most
others have black text on white background).

On most systems (I forget if OS/2's console windows support this) I set
the default palette for windows to coincide with what makes the best
contrast, and then use the terminfo to tell applications how to draw color
on that. Forcing the standout, underline and reverse strings to show
different color combinations defeats that.
--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net
Loading...