bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trouble with wattr_set()


From: Bryan Christ
Subject: Re: Trouble with wattr_set()
Date: Fri, 25 Jan 2019 15:08:04 -0600

Timothy,

I discovered that on Bionic, NCURSES_EXT_COLORS is not defined, but on Fedora 29 it is.  Would that matter?  I wouldn't see why it should since pair 766 (in my example) fits well within a short.  Or is NCURSES_EXT_COLORS is somehow relevant for anything greater than 8 bits?

On Mon, Jan 21, 2019 at 7:16 PM Timothy Allen <address@hidden> wrote:
On Mon, 2019-01-21 at 10:57 -0600, Bryan Christ wrote:
> The only explanation
> that I can see for the behavior is that xfce, gnome-term, etc, are
> really vte which has a limit of 256 pairs or less.

Some terminals support colour pairs at the hardware level, like
"hpterm-color". These use the "scp" terminfo string ("set colour pair")
to tell the terminal which colour pair to use. These terminals are
called "HP-like" in terminfo(5).

The vast majority of terminals, pretty much every terminal or terminal
emulator you'll interact with unless you're a vintage hardware
collector, do not support colour pairs at the hardware level, they
allow the foreground and background colours to be set independently at
any time. These terminals use the "setaf" and "setab" terminfo strings
("set ANSI foreground" and "set ANSI background"). These terminals are
called "Tektronix-like" in terminfo(5).

The ncurses API always uses colour pairs on every terminal, because
it's possible to emulate colour pairs on a Tektronix-like terminal, but
it's not possible to emulate free foreground and background colours on
an HP-like terminal. For the sake of having a single, unified
interface, colour pairs it is.

All this to say: vte does not have a limit of 256 colour pairs, it
doesn't know anything about colour pairs. Inside vte, colour pairs are
purely a part of ncurses.

As for your original test, I'm pretty sure color_content() is only
reliable for colours previously created with init_color(). Although
xterm (to name an example) has a control sequence to query color
content, I can't find a standard name for it in terminfo(5), and most
programs I've seen just assume the standard xterm 256 colour palette.

> > However, on Bionic, the text is there but color attributes are
> > something like dark gray on black.  When I add debug code with
> > pair_content() and color_content() everything looks fine:
> >
> > pair: 766, f: 245, g: 235

Colour 245 in the standard xterm 256 color palette is a medium grey,
and colour 235 is a very dark grey, so it sounds like Bionic's is the
behaviour I would expect, unless you're using init_color() to redefine
a palette entry, and all the terminal-like processes between your
application and the screen (the GUI terminal emulator, as well as
intermediate tools like tmux, screen, and mosh) all support modifying
the palette.

Konsole is one fairly widely used terminal that does not support
modifying the palette. tmux *can* modify the palette, but only if the
outer terminal (that tmux is running inside) uses the non-standard "Tc"
terminfo capability to indicate that it supports true-color output, and
the tmux terminfo entry is amended to include the "ccc" and "initc"
capabilities.



_______________________________________________
Bug-ncurses mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/bug-ncurses


--
Bryan
<><

reply via email to

[Prev in Thread] Current Thread [Next in Thread]