Subject: Re: colours for info & man displays
From: Brian Dessent <[email-masked]>
To: [email-masked]
Date: Fri, 07 Nov 2003 07:01:04 -0800

zzapper wrote:

> I always use a Win32 Console for CYGWIN with light turquiose set as
> background colour and black for text. This is setup via Win32 Console
> properties.
> 
> The Cygwin prompt color is green. My problem is that in INFO or MAN
> pages this green is practically invisible against the highlight colour
> used for the status bar
> 
> PS1=\[\033]0;\w\007
> 
> questions)
> 
> q1) Where is PS1 set?
> 
> q2) How can I change the green colour?

It's set in /etc/profile by default.  Also, the default setting is
actually:

export PS1='\[\033]0;\w\007
\033[32m\]\u@\h \[\033[33m\w\033[0m\]
$ '

Note the line breaks -- you could achieve the same affect with \n
without spanning multiple lines.  The first segment of the prompt does
not actually display anything.  "\033]0;\w\007" is the code to set the
rxvt window title.  \w is replaced by the current working directory, but
you could put anything there you want.  The \[ and \] sequences tell
bash that the enclosed characters are non-printing, i.e. control
characters.  This is so that bash doesn't get confused as to which
column the cursor is on.  The part that actually sets the color is done
by "\033[32m".  32 means green, and the general form of this command is
"\033[#;#...#;m" where each # specifies an attribute.  See for example
<http://www.bluesock.org/~willg/dev/ansi.html>.  Note also that \033 is
the octal representation of the ESC character.  You can also use \e.

Finally, there is the list of escape sequences that bash substitutes,
i.e. \w, \u, etc.  A full list can be found here:
<http://www.gnu.org/manual/bash-2.05a/html_node/bashref_74.html#SEC81>

That should be all you need to fiddle around with the colors and/or
layout.  For example, my prompt is currently:

export PS1='\[\e]0;\l \w\007\n($?) \t \[\e[36m\]\l \[\e[32m\]\u@\h
\[\e[33m\]\w\[\e[0m\]\n$ '

(That should be all on one line.)  I like having the tty number in the
window title, as well as the timestamp and return value of the previous
command displayed at the prompt.

Brian

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