[m-rev.] for review: options to control the use of color

Peter Wang novalazy at gmail.com
Sun May 5 13:11:14 AEST 2024


On Sat, 04 May 2024 00:25:19 +1000 "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
> 
> I have no idea whether things are so bad on other setups,
> but these experiences with two reasonably common systems
> lead me to believe that many people probably have a selection of colors
> in the standard 16 slots in their terminal that they treat as a black box
> that is not worth messing with

If you search for terminal color schemes or themes, you will find a
plethora of schemes that people have created.

What that says, I leave to you.

> > I'm asking that the Mercury compiler respect the user's chosen color
> > scheme by default, like most programs. That's it.
> 
> Except users have chosen only a colors to go into the slots; the other half of
> the color scheme, the assignment from color slots to color roles,
> they have not chosen.

Right, this seems to be the heart of the disagreement. I don't care to
configure the second half, the assignment of color slots to roles,
assuming they are somewhat sensible (which they are).
This applies to other programs, too.

> I leave it up to you guys to propose the names of the options and env  vars,
> provided of course that you accept this compromise.

I would have proposed the same thing if you didn't change your mind.

My suggestion:

    --color-scheme=dark16|dark256|light16|light256

    MERCURY_COLOR_SCHEME (environment variable)

(or theme instead of scheme; the two words seem to be used
interchangeably)

The "light" schemes would use normal (non-bright) colors, which look
better on a light background. Bright yellow text, in particular, is
completely unreadable on a white background. Bright green and bright
cyan are marginal. If we abstain from using bright yellow text, the
"dark" schemes would probably not be too objectionable on a light
background.

I think it's important that the compiler output be readable for everyone
out of the box. That means either not enabling colors by default,
or defaulting to a scheme that does not use bright yellow.

FWIW, this is what I found in the GCC manual, in terms of the colors
that they find acceptable to use by default:

     The default ‘GCC_COLORS’ is
          error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
          quote=01:path=01;36:fixit-insert=32:fixit-delete=31:\
          diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
          type-diff=01;32:fnname=01;32:targs=35
     where ‘01;31’ is bold red, ‘01;35’ is bold magenta, ‘01;36’ is bold
     cyan, ‘32’ is green, ‘34’ is blue, ‘01’ is bold, and ‘31’ is red.
     Setting ‘GCC_COLORS’ to the empty string disables colors.

Peter


More information about the reviews mailing list