delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/11/07/10:01:59

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <3FABB3B0.C44942FD@dessent.net>
Date: Fri, 07 Nov 2003 07:01:04 -0800
From: Brian Dessent <brian AT dessent DOT net>
Organization: My own little world...
X-Accept-Language: en,en-US
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: colours for info & man displays
References: <m11nqv8orsv5j838v0cbdon5610hlll0iu AT 4ax DOT com>
X-AntiAbuse: This header was added to track abuse, please include it with any abuse report
X-AntiAbuse: Primary Hostname - host.linuxsv3.net
X-AntiAbuse: Original Domain - cygwin.com
X-AntiAbuse: Originator/Caller UID/GID - [0 0] / [47 12]
X-AntiAbuse: Sender Address Domain - dessent.net
Note-from-DJ: This may be spam

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019