All of lore.kernel.org
 help / color / mirror / Atom feed
* report default colors
@ 2022-12-22 17:47 James Lowden
  2022-12-23  1:32 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: James Lowden @ 2022-12-22 17:47 UTC (permalink / raw)
  To: git

Hi, 

My good friends, I would like a way to report all colors, default and configured, used by git.  

I can report configured colors, 

$ git config --get-regexp color
color.diff.meta black bold
color.diff.frag magenta bold
color.diff.old red bold
color.diff.new blue bold

which is not terribly useful, because those values came from a file I control.  

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.  (Don't get me started on the pointlessly difficult antiquated arcane color control of ANSI terminals.)  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.  

What I would like to do is identify every color git is using for every purpose.  That would let me change, say, all yellow to yellow-on-black.  But I have no way to discover what shows up in yellow, other than intuition.  

Thank you for your kind consideration of my suggestion.  

--jkl


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: report default colors
  2022-12-22 17:47 report default colors James Lowden
@ 2022-12-23  1:32 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2022-12-23  1:32 UTC (permalink / raw)
  To: James Lowden; +Cc: git

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-12-23  1:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-22 17:47 report default colors James Lowden
2022-12-23  1:32 ` Junio C Hamano

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.