All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Irving Rabin <irving@edmodo.com>
Cc: git@vger.kernel.org
Subject: Re: Coloring
Date: Wed, 31 May 2017 17:04:48 -0400	[thread overview]
Message-ID: <20170531210448.6kolid5umzyasxnc@sigill.intra.peff.net> (raw)
In-Reply-To: <CAD1ypiWOcKaLJJzZC=gw75EDFnw_1ZqC94B5p9i722T-sijN1Q@mail.gmail.com>

On Wed, May 31, 2017 at 11:33:31AM -0700, Irving Rabin wrote:

> Specifically, if the field is supposed to be white, it doesn't mean it
> should be literally 0xFFFFFF. It should be the color that I have
> configured as White color for my console emulator.
> 
> I like light-screen terminals, and I configure my ANSI colors in the
> way that they are clearly visible on the background and clearly
> distinct between themselves. In my terminal settings background is
> light-yellow, Black is black, Yellow is brown, Red is dark red,
> Magenta is purple and White is dark gray. I set it once and I can use
> it everywhere - all Unix commands work correctly, I can edit
> highlighted source code in Vim, and all my color settings are
> respected.

Git outputs ANSI color codes, which are interpreted by your terminal.
You _can_ configure Git to send 24-bit color codes if your terminal
supports it, but by default it uses the traditional set of limited color
and attribute codes.

What does running the following snippet in your shell look like?

-- >8 --

while read name code; do
	printf '\033[%sm%s\033[m\n' "$code" "$name"
done <<-\EOF
normal
bold 1
red 31
green 32
yellow 33
blue 34
magenta 35
cyan 36
bold-red 1;31
bold-green 1;32
bold-yellow 1;33
bold-blue 1;34
bold-magenta 1;35
bold-cyan 1;36
EOF

-- 8< --

If any of the colors are not what you expect, is there a pattern? E.g.,
I wouldn't be surprised if "bold" shows up as bright white. In many
modern terminal emulators, the bold variants need to be configured
separately from the non-bold ones, and default to lighter variants of
their non-bold counterparts. The solution there would be to check your
terminal emulator config.

If it does all look as you'd expect, try adding "| less -R" to the end of
the "done <<-\EOF" line. Most of Git's output goes through that pager
(though I _think_ it's mostly just passing through the ANSI codes, so it
wouldn't have any effect).

-Peff

  parent reply	other threads:[~2017-05-31 21:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-31 18:33 Coloring Irving Rabin
2017-05-31 19:07 ` Coloring Samuel Lijin
2017-05-31 21:04 ` Jeff King [this message]
2017-05-31 21:10   ` Coloring Irving Rabin
2017-05-31 21:22     ` Coloring Samuel Lijin

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=20170531210448.6kolid5umzyasxnc@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=irving@edmodo.com \
    /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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.