This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to set the colors of terminfo's standout mode?


  Thanks all for your responses.

  Barry, you have given me a workaround and enabled me to find a second
workaround!

  If people still want to try to find a better solution, I have
'attached' instructions on how to (try to) reproduce the problem.

Barry Buchbinder wrote:
[deleted]
> 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.

  That did not work ("Normal." is normal (i.e. black on white), "Black
on while." is also normal (black on white) and "Normal again." is
lightgrey-on-black and the display stays that way instead of going back
to normal black on white). But not to worry, read on.

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

  (When, as is my 'need', starting with black text on a white
background,) The only combination which shows the desired white-on-black
is "1;37;40" (more about that later). The " 7 = reverse video = 30;47 "
part is displayed as black-on-lightgrey.

> >   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.

  Thanks! That indeed displays as the desired white-on-black. The
disavantage of this is that it is hardcoded, i.e. for my normal
black-on-white it effectively is 'inverse-video', however for other
normal (non-inverse) colors, it would not be inverse-video, but just
white-on-black. Read on.

  Now that I knew the effect of "1" (bold), I continued with the escape
sequences which I got from Cygwin B20's /etc/termcap entry for "cygwin"
(= "linux"): mr=\E[7m:so=\E[7m:se=\E[m

  I came up with:

\cygwin\bin\echo -en '\033[1;7mThis is a text.\033[0m'

which gives white (desired) text on a dark-grey (undesired) background.

  This is my second workaround. It has better contrast than the default
(lightgrey-on-darkgrey), but less contrast than the above hardcoded
white-on-black. The advantage of this workaround is that the colors are
not hardcoded, i.e. I just say "bold" and "inverse video".

  While not ideal, these workarounds will do for now. Now I will have to
get them into a new terminfo entry (Yes, I know how to do that, but have
to install untic and friends, etc..).

What next?
==========

  In case anyone wants to try reproduce my problem and then try to find
a better solution:

[FWIW, I have Windows XP (Professional).]

[While I have the problem in a 'DOS', i.e. non-(bash-)shell window, I
will give the procedure for a default bash window, because that is
probably easier.]

- Start with the default bash window [1] that came with Cygwin (in my
  case 1.3.x, since updated to 1.5.9): Start -> All Programs -> Cygwin
  -> Cygwin Bash Shell.

- Temporarily change the forground/background colors: Click on the
  upper-left icon -> Properties -> Colors -> "Screen Text" to black
  (0/0/0) and "Screen Background" to white (255/255/255).
  In case it matters, my Font is the default, "Raster Fonts" with "Size"
  "8 x 12".

- echo -en '\033[7mThis is a text.\033[0m'
  This will probably be lightgrey-on-darkgrey. If so, you have
  reproduced my problem (because I want white-on-black).

- /bin/echo -en '\033[1;37;40mThis is a text.\033[30;0m'
  This will probably be white-on-black, i.e. the hardcoded workaround
  which Barry gave.

- /bin/echo -en '\033[1;7mThis is a text.\033[0m'
  This will probably be white-on-darkgrey, i.e. the second workaround
  which I gave.

  A better solution would be one which 1) does *not* hardcode the
colors, 2) *does* use inverse video ("7") and 3) displays
white-on-black.

[1] I.e. the ('DOS') "Command Prompt"-like window which is started by
the shorcut which executes ("Target:) C:\cygwin\cygwin.bat, which
contains:
[Start cygwin.bat:]
@echo off

C:
chdir C:\cygwin\bin

bash --login -i
[End cygwin.bat]





--
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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]