zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@sunsite.dk
Subject: Remarks on Alex Polite's color names
Date: Tue, 04 Jul 2006 00:17:16 -0700	[thread overview]
Message-ID: <060704001716.ZM31627@torch.brasslantern.com> (raw)

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


             reply	other threads:[~2006-07-04  7:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-04  7:17 Bart Schaefer [this message]
2006-07-04  7:47 ` Archive delays (Was: Remarks on Alex Polite's color names) Geoff Wing
2006-07-04  9:23 ` Remarks on Alex Polite's color names Phil Pennock
2006-07-06 19:17   ` Alex Polite
2006-07-06 19:58     ` Nikolai Weibull
2006-07-07 11:33     ` Phil Pennock
2006-07-07 12:46       ` Alex Polite
2006-07-07 20:39         ` Vin Shelton
2006-07-10  1:05         ` djh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=060704001716.ZM31627@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).