[PATCH 3 of 4] color: automatically define 16 and 256 colors if supported

Gregory Szorc gregory.szorc at gmail.com
Mon Jul 10 00:27:58 EDT 2017


On Sun, Jul 9, 2017 at 9:21 PM, Jun Wu <quark at fb.com> wrote:

> Excerpts from Gregory Szorc's message of 2017-07-09 16:46:16 -0700:
> > [...]
> > @@ -146,6 +179,43 @@ def _terminfocolors(ui):
> >      for color, value in TERMINFO_COLOR_8.items():
> >          colors[color] = (value, False)
> >
> > +    # Add 16 and 256 bit colors if supported and allowed by config
> policy.
> > +    #
> > +    # There's no reliable way to detect if the extra colors will
> actually work.
> > +    # The terminfo database just reports what the current terminal is
> > +    # advertising. Some terminals support querying the value of a color
> via
> > +    # e.g. \e]4;%d;?\a. However, this isn't universally supported. So
> set
> > +    # colors based purely on terminfo and provide users a way to
> disable in
> > +    # case it doesn't work.
> > +
> > +    # Will likely return -1 on failure.
> > +    termcolors = curses.tigetnum('colors')
>
> Should we check if curses is None here? It seems "debugcolor" will call
> this
> and could be problematic on Windows.
>

Yes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20170709/0236fe01/attachment.html>


More information about the Mercurial-devel mailing list