bug-ncurses
[Top][All Lists]
Advanced

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

Re: Issue using more than 255 color pairs


From: Thomas Dickey
Subject: Re: Issue using more than 255 color pairs
Date: Sun, 16 Jul 2023 04:35:08 -0400

On Sat, Jul 15, 2023 at 05:55:44PM -0400, Thomas Dickey wrote:
> On Sun, Jul 16, 2023 at 12:06:31AM +0200, David Unterwandling wrote:
> > In-Reply-To: <ZLK77gvDufh2Rwhb@prl-debianold-64.jexium-island.net>
> > References: <ZLK77xDE6pSvXDCB@scw>
> >  <ZLK77gvDufh2Rwhb@prl-debianold-64.jexium-island.net>
...
> > #define A_COLOR NCURSES_BITS(((1U) << 16) - 1U, 0)
> 
> I suppose you're wondering why you can't make the program work if you are
> redefining constants in curses.h ?
> 
> By redefining it, you moved your program's sense of where the attribute
> and color bits are -- but ncurses didn't move.
>  
> >     attron(COLOR_PAIR(260));
> 
> this line (as seen in ncurses) is
>   
>       attron(A_STANDOUT | COLOR_PAIR(4));

...so that will never work:

a) the terminal description which you are (probably) using says COLORS==256.

b) the mask for A_COLOR will not change because it refers to bits in chtype.

Rather than using the SVr4-compatible "attron", if you were using a terminal
description with more than 256 colors (such as xterm-direct), then the X/Open
interfaces using cchar_t rather than chtype would help:

       int attr_get(attr_t *attrs, short *pair, void *opts);
       int wattr_get(WINDOW *win, attr_t *attrs, short *pair, void *opts);
       int attr_set(attr_t attrs, short pair, void *opts);
       int wattr_set(WINDOW *win, attr_t attrs, short pair, void *opts);

-- 
Thomas E. Dickey <dickey@invisible-island.net>
https://invisible-island.net

Attachment: signature.asc
Description: PGP signature


reply via email to

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