git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] help: colorize man pages

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
May 19, 2021, 10:25 UTC
Message-ID
<60a4e799ce22e_86a8208b7@natae.notmuch>
In-Reply-To
<YKRSlFcFAcHcR3uY@camp.crustytoothpaste.net>
brian m. carlson wrote:
Show 19 quoted lines
> On 2021-05-18 at 03:22:37, Felipe Contreras wrote:
> > brian m. carlson wrote:
> > > I think we should let the user decide whether they want to set this
> > > feature themselves instead of setting it for them.  For example, I have
> > > specific colors set up with these environment variables, and I'd like
> > > Git to honor them without having to configure Git independently of less.
> > > I expect other users will expect Git's rendering of the manual pages to
> > > work like other instances of man(1) on their system as well.
> > 
> > It does respect them.
> > 
> > This would render the man page with the color specified in the
> > environment, not the default of git.
> > 
> >   LESS_TERMCAP_md=$'\e[1;33m' LESS_TERMCAP_me=$'\e[m' git help git
> 
> It still doesn't work like other instances of man(1) on the system.
> While you claimed that "that's a preference others don't share", I'm
> pretty certain that I'm not the only person who feels this way.

Two people feeling in a certain way is not an argument against a feature that could potentially benefit millions of people.

> There's a big difference between Git coloring a Git UI, like a diff, and
> Git coloring a separate program that already has sensible, standard
> defaults.

Would you be happier if I implement an entirely new library to render asciidoc documentation in a pretty way and make `git help` link to that?

That way we wouldn't be using "a separate program".
> A user who has not configured any color settings would
> probably not want Git to render manual pages one way, cargo to render
> manual pages a second way, and still other programs to render manual
> pages in other, incompatible ways.
That is one opinion. Again, not shared by everyone.
> Would you consider various projects coloring their respective manual
> pages differently to be a desirable state of affairs?

That is irrelevant, because we are not talking about `man git`, we are talking about `git help git`, which can render help in a variety of ways.

You can do for example `git -c man.viewer=woman help git`, and the result would be *completely* different from what the user sees in `man git`.

A different thing is different.
Would you be happier if we enable this with `man.viewer=mancolor`?
Show 9 quoted lines
> > > Additionally, using colors poses accessibility problems.  I know someone
> > > who, due to his colorblindness, finds terminal colors distracting and
> > > hard to read, and prefers not to use them at all.
> > 
> >   git -c color.ui=never help git
> 
> Yes, but unfortunately, since you've colored the manual pages, they may
> be hard to read for the user who needs to read them to learn about your
> configuration.
man git
Show 13 quoted lines
> > > Even users who want to use them might find some colors to be too
> > > similar, and this patch doesn't permit them to be configured.
> > 
> > Yes it does:
> > 
> >   LESS_TERMCAP_md=$'\e[01;38;5;33m' git help git
> 
> I should clarify that the patch doesn't permit them to be configured
> using the normal Git mechanisms.  For example, unless the user sets the
> environment variables, which take effect globally, they're stuck with
> the colors that we've chosen here.  Yes, they can specify a single
> environment variable before the command, but practically nobody will do
> that.
If you don't like the colors they can disable them.
They lose absolutely nothing from the state of git 2.31.
> It's my argument that the user doesn't want Git manual pages to be
> colored differently than other manual pages on the system,
/usr/share/man/man1/git.1.gz is not changed.
Show 11 quoted lines
> > > In my particular case, despite having normal color vision, because I use
> > > a transparent terminal which often results in a grey background, I find
> > > the standard terminal red to be difficult to read, and so this patch
> > > would result in a significant decrease in the readability of the manual
> > > pages for me.
> > 
> > If you have LESS_TERMCAP_md set in your environment, it won't.
> 
> The problem is, I don't always.  I am on call for a set of hundreds of
> servers, only one of which has my shell configuration set up, so
> defaults here matter.
Surely you can live typing `man $x` instead of `git help $x` for a bit.
> Moreover, because there are many novice users of
> Git, we should consider that for a decent number of users, they
> literally won't know where to look in our documentation to make
> changes, and therefore the defaults matter for them, too.
And we are considering them.
But the defaults are for the majority.
-- 
Felipe Contreras
Previous: Felipe Contreras
Message 33 of 33 in “help: colorize man pages”
  1. help: colorize man pagesFelipe Contreras, May 18, 2021
  2. brian m. carlsonMay 18, 2021
  3. Felipe ContrerasMay 18, 2021
  4. brian m. carlsonMay 18, 2021
  5. Junio C HamanoMay 19, 2021
  6. brian m. carlsonMay 19, 2021
  7. Junio C HamanoMay 19, 2021
  8. Ævar Arnfjörð BjarmasonMay 19, 2021
  9. Felipe ContrerasMay 19, 2021
  10. brian m. carlsonMay 21, 2021
  11. Felipe ContrerasMay 21, 2021
  12. Igor DjordjevicMay 21, 2021
  13. Felipe ContrerasMay 21, 2021
  14. Igor DjordjevicMay 21, 2021
  15. Felipe ContrerasMay 21, 2021
  16. Igor DjordjevicMay 22, 2021
  17. Felipe ContrerasMay 22, 2021
  18. Igor DjordjevicMay 23, 2021
  19. Felipe ContrerasMay 23, 2021
  20. Igor DjordjevicMay 21, 2021
  21. Junio C HamanoMay 21, 2021
  22. Ævar Arnfjörð BjarmasonMay 19, 2021
  23. Jeff KingMay 19, 2021
  24. Felipe ContrerasMay 19, 2021
  25. Felipe ContrerasMay 19, 2021
  26. Felipe ContrerasMay 19, 2021
  27. brian m. carlsonMay 20, 2021
  28. Junio C HamanoMay 20, 2021
  29. Felipe ContrerasMay 20, 2021
  30. Junio C HamanoMay 20, 2021
  31. Felipe ContrerasMay 20, 2021
  32. Felipe ContrerasMay 20, 2021
  33. Felipe ContrerasMay 19, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.