Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Remarks on Alex Polite's color names
- X-seq: zsh-users 10472
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Remarks on Alex Polite's color names
- Date: Tue, 04 Jul 2006 00:17:16 -0700
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
[Why are none of Alex's messages in the zsh-users archive, even though
all the messages that reference them are there? The original one is in
gmane, marked as expiring on July 17, but none of the followups.]
The recent discussion about colored prompts with newlines included a
number of parameter declarations such as
fg_brown=$'%{\e[0;33m%}'
fg_purple=$'%{\e[0;35m%}'
I wanted to point out a few things about this, before someone looks at
the "colors" function in the zsh distribution and says "Hey, why are
brown and purple not defined in the $fg array?"
Colors 33 and 35 are defined by the ANSI terminal spec as yellow and
magenta, respectively, not brown and purple. In order to make "normal"
and "bold" yellow distinct while still making them both readable, many
terminal emulators now render "normal yellow" as a shade of tan rather
than as a true yellow. For similar reasons (and as commented in the
"colors" function source), "white" is frequently a very faint grey and
"bold white" is truly white, and "black" is a very dark grey to appear
different from 'bold black". This also applies to magenta -- against
a (not quite) white background, the "normal" magenta looks purple, and
"bold magenta" really is magenta (which Alex calls fg_light_purple).
You can see all this better against a black (bold black) background;
the color that looks tan/brown on white, looks much yellower on black.
As for the exact escape sequence in $fg_brown above: the zero before
the semicolon has the effect of resetting all color attributes before
setting the foreground to yellow. This means that you can't combine
Alex's $fg_brown with a background color. If the "0;" is omitted, the
same foreground color is set, without first resetting the background or
other attributes.
In fact the form with the semicolon is a shortcut. You can set all the
attributes sequentially instead, e.g. $'\e[0m\e[33m'. You can also use
more than one semicolon, e.g.$'\e[5;40;33m' is black background with
blinking yellow foreground.
Look in the "colors" function file for other attribute values. You'll
see there that "1" (as in "1;31" for Alex's fg_light_red) is meant to
describe "bold", not "light" colors.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author