git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: James Lowden <james.k.lowden@icloud.com>
Cc: git@vger.kernel.org
Subject: Re: report default colors
Date: Fri, 23 Dec 2022 10:32:24 +0900	[thread overview]
Message-ID: <xmqqili2rjkn.fsf@gitster.g> (raw)
In-Reply-To: <FC7C600C-5D51-4BE0-82BD-9E28C88A1BB8@icloud.com> (James Lowden's message of "Thu, 22 Dec 2022 12:47:44 -0500")

James Lowden <james.k.lowden@icloud.com> writes:

> I can get a list of all keys from "git help", which is something.
> But I'm left guessing at which keys control the text on the screen
> for a given command, and what color they are.
>
> In the instant case, "git push" was rejected, and the reason is
> impossible to read because it's in yellow on a light blue
> background.

Interesting.  I wonder where you are getting the yellow from.  The
hardcoded default comes from these in builtin/push.c

    static int push_use_color = -1;
    static char push_colors[][COLOR_MAXLEN] = {
            GIT_COLOR_RESET,
            GIT_COLOR_RED,	/* ERROR */
    };

    enum color_push {
            PUSH_COLOR_RESET = 0,
            PUSH_COLOR_ERROR = 1
    };

and the push_colors[PUSH_COLOR_ERROR][] is used here

	...
	if (err != 0) {
		fprintf(stderr, "%s", push_get_color(PUSH_COLOR_ERROR));
		error(_("failed to push some refs to '%s'"), anon_url);
		fprintf(stderr, "%s", push_get_color(PUSH_COLOR_RESET));
	}

so I wouldn't be surprised if you see this painted in red, but yellow?

In any case, there are two things _we_ should do on our end.

One obviously is to document the default when we document
configurables (e.g. color.push.error only says "Use customized color
for push errors", but it should say by default it uses red).

The other is about this part:

> ...  My workaround
> is to guess what it probably says (probably it says I need to
> pull).  When that doesn't work, I copy and paste the text into
> emacs.

No color is well recognizable on all backgrounds, and people use
different background, so we need to make sure that our coding
guidelines tell our developers (1) not to use unusual colors for
common things, and/or (2) make both foreground and background
configurable.

(1) is because if we stick to small number of common colors, it
would make it easier for users to find and use a single background
that works well with these colors.

(2) is because there will be some users who find whatever common
default colors we use not working for them.  They may need higher
contrast between background and foreground, and allowing both be
tweakable would make it easier for them to find the color pairs that
work well.

Thanks.

      reply	other threads:[~2022-12-23  1:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-22 17:47 report default colors James Lowden
2022-12-23  1:32 ` Junio C Hamano [this message]

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=xmqqili2rjkn.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=james.k.lowden@icloud.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 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).