Subject: RE: How to set the colors of terminfo's standout mode?
From: "Buchbinder, Barry (NIH/NIAID)" <[email-masked]>
To: [email-masked]
Cc: "'Frank Slootweg'" <[email-masked]>
Date: Thu, 29 Apr 2004 11:17:59 -0400

> -----Original Message-----
> From: Frank Slootweg
> Sent: Thursday, April 29, 2004 9:28 AM
> To: [email-masked]
> Subject: Re: How to set the colors of terminfo's standout mode?
> 
>   Thanks, Alejandro and Hannu, for your additional responses.
> 
>   I am again getting closer, but still not there. Please bear with me.
> 
>   At the time, I did not quite understand this part from Alejandro:
> 
> A> OK. In my experience, you can set the fg/bg colors the way you want
> A> by modifying the system settings in the shortcut (right-click on
> A> window bar and modify properties there), or by using *bold colors* in
> A> your definitions. For some reason, in the win32 console \e[00;30m is
> A> grey and \e[01;30m is white.
> 
>   Now that I know what these escape sequences mean (thanks to the
> document which Alejandro posted and [1]), I understand that part better.
> 
>   However, *whatever* I do, I can never get the text/foreground color
> white. 37 should do that, but it gives me light-grey instead
> (192/192/192 in "Selected Color Values" of Properties).
> 
>   Also Alejandro's escape sequences do not work for me. \e[00;30m gives
> me black text on a white background (i.e. no change) and \e[01;30m gives
> me light-grey text on a white background. 01 is Bold, so according to
> Alejandro that should give me white (text), but it gives me light-grey.

It is a fact of color: the only difference between grey and white is
intensity; any white can be made to look grey when compared to a more
intense white.  What you see as light grey is what was long ago in IBM PC
land defined as white so that what you want to call white could be used for
bold.  (Indeed, black can also be relative, being varying shades of dark
grey, until on gets down to true black (zero photons).)

The "1" makes the foreground color more intense.  "5" should cause blinking
but may end up making the background color more intense.  Try

\cygwin\bin\echo -en 'Normal. \033[30;47;5mBlack on while.\033[0;37;40m
Normal again.'

to get black on white.

The script in http://sources.redhat.com/ml/cygwin/2004-04/msg01161.html
should show you how everything looks on your system.

>   The best I get so far is:
> 
> \cygwin\bin\echo -en '\033[37;40mThis is a text.\033[30;0m'
> 
>   Which gives me light-grey (instead of the desired white) text on a
> black (as desired) background.

Try 
\cygwin\bin\echo -en '\033[1;37;40mThis is a text.\033[30;0m'
The added "1" bolds the "37", which should turn foreground light-grey to
real white.

>   I still did not understand why the old (tin) executable on the old
> Cygwin B20 release could give white on black, because it seems to be a
> pure Win32 console issue.
> 
>   B20 apparently used /etc/termcap instead of terminfo (there is no
> terminfo directory), but also the B20 /etc/termcap ("cygwin" = "linux")
> escape sequences for rev/mr, smso/so and rmso/se give light-grey on
> dark-grey (instead of white on black). Those escape sequences were
> mr=\E[7m:so=\E[7m:se=\E[m
> 
>   However *those* (\E[7m and se=\E[m) escape sequences *do* bring me
> closer:
> 
>   If I use *those* (\E[7m and se=\E[m) escape sequences with *B20*'s
> echo(1) command, I *do* get white (desired) text on black (desired)
> background, while with the *new* (1.5.9) echo(1) command, I get
> light-grey (undesired) on dark-grey (undesired).
> 
>   I.e. in short: With B20 versus 1.5.9 echo(1) commands, I see the
> *exact same* behaviour as I see with the B20 versus 1.5.9 tin
> executables!
> 
>   So it seems that this is not a terminfo problem, but another type of
> Cygwin problem and that even something as simple as echo(1) is somehow
> 'terminal/color aware [2]!
> 
>   Anyone any idea *where* those (echo(1) et al related) color settings
> can be set? I.e. what makes 1.5.9's echo(1) command display a
> white-on-black escape sequence as lightgrey-on-black or lightgrey-on-
> darkgrey?
> 
> [1] Linux Magazine  September 2003  POWER TOOLS  Escape Sequences Useful
> Text that You Can't See:
> http://www.linux-mag.com/downloads/2003-09/power/escape_sequences.html
> 
> [2] For some reason *DOS* echo, type and "copy ... con" commands
> *display* [3] the escape characters instead of executing them, so I had
> to use echo(1). If someone knows a way to let *DOS* commands execute
> escape sequences instead of displaying them, then please let me know.

This is normal if ansi.sys is not loaded.  (In config.sys, device=ansi.sys
or the like.)  ansi.sys is what interprets the ansi escape commands.  On XP,
one cannot load ansi.sys into cmd.exe, but one can load it into command.com.
(I think command.com uses the DOS subsyem, while cmd.exe is an NT console
program.)

Presumably, cygwin performed some of its magic when you used its echo even
in a DOS box.

> [3] Where the escape character is displayed as a (1-character)
> back-arrow character.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/