On 8/25/25 18:28, Thomas Dickey wrote:
On Tue, Aug 26, 2025 at 01:17:01AM +0200, Jakub Horký wrote:
po 25. 8. 2025 v 23:20 odesílatel Thomas Dickey <[email protected]> napsal:
I have in mind a different scheme, which would allow for RGB when available
to be used explicitly.  No compatibility layer.


May I ask what scheme you have in mind?

There are several parts, taking into account ABI compatibility with plans
for a new ABI 7.  Changing the size of attr_t requires a new ABI, which
takes more time than most people can imagine.

In the existing ABI 6, seeing that there are no existing uses of sgr1,
to use the corresponding A_xxx bits to support a color palette for
the 24-bit colors.  This chunk in curses.h was more convenient to
add, a few months ago, than keeping it in a branch:

        #if 1   /* NCURSES_EXT_FUNCS */
        #define A_ITALIC        NCURSES_BITS(1U,23)     /* ncurses extension */
        #if 0   /* NCURSES_RGB_COLORS */
        #define A_FOREGROUND    NCURSES_BITS(1U,17)     /* ncurses extension */
        #define A_BACKGROUND    NCURSES_BITS(1U,18)     /* ncurses extension */
        #define A_DIRECT        (A_FOREGROUND|A_BACKGROUND)
        #endif /* NCURSES_RGB_COLORS */
        #endif /* NCURSES_EXT_FUNCS */

It would have to be a (limited-size) palette, for both compatibility and
performance reasons.  Aside from people playing with pictures, a limited
size is fine.

I'm unclear on how this actually works. I gather the idea is that you'll have plenty of "traditional" color pairs and colors, and can still use init_pair() and friends. But you can also mix in, say,

attrset( A_FOREGROUND);

and then (if direct color is available) you can, through suitable legerdemain, set the foreground color to a particular RGB triplet. Or attrset( A_DIRECT); and then set both foreground and background. And then return to traditional color pairs and a palette. Is that correct?

-- Bill

Reply via email to