Subject: Re: [PATCH] help: colorize man pages

From: Felipe Contreras <[email-masked]>
Date: Mon, 17 May 2021 22:22:37 -0500

brian m. carlson wrote:
> On 2021-05-18 at 01:01:21, Felipe Contreras wrote:
> > Our man pages don't contain many useful colors (just blue links),
> > moreover, many people have groff SGR disabled, so they don't see any
> > colors with man pages.
> > 
> > We can set LESS_TERMCAP variables to render bold and underlined text
> > with colors in the pager; a common trick[1].
> > 
> > Bold is rendered as red, underlined as blue, and standout (messages and
> > highlighted search) as inverse magenta.
> > 
> > This only works when the pager is less, and the color.pager
> > configuration is enabled, as well as color.ui.
> 
> 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

> 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

> 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

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

-- 
Felipe Contreras