This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Customising prompt
Robert Bram wrote:
> The issue is this: the I am getting black text on grey background - why is this? I thought "\e[30;47m " means black text on white background. That is what I understood from this page:
> http://www.pantz.org/scripting/shell/colorterm.shtml
The way that the ANSI escape sequences work is that there are 8 colors
and 2 intensities for each. The 30 through 37 and 40 through 47 codes
set the FG and BG to one of those 8 colors. So 47 really is gray,
because it's the low-intensity version of that color. If you want white
you have to switch to the high-intensity version.
But, back in the old DOS days (early/mid 80s) the CGA adapter used the
intensity bit of the background color nibble to designate blinking,
which meant that you were limited to the 8 lower intensity colors for
the background of text. But if I recall correctly you could toggle
this, and sacrifice the ability to have blinking text for the ability to
use the high-intensity background colors.
Anyway this is a long-winded way of saying that you need to include the
"blink" attribute in your ANSI sequence if you want the background to be
white. Try "\e[5;30;47m".
However, I suggest that instead of setting the overall text color of the
console with the prompt, that you set it when the console is created.
If you are using CMD.EXE you need to go to the properties of the
shortcut and mess with the "Colors" tab. If you're using rxvt then you
can set it using command line parameters and/or resources. If you do it
this way, the default colors of the console are set for you without
having to do it with the prompt. For example, if you run vim then it
will go back to the default color set because it's not using the colors
in the prompt. If you set the color of the console itself, you
shouldn't have this problem.
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/