On 2/2/26 05:57, Robin Haberkorn wrote:
It's ncurses that behaves differently here (but is IMHO most faithful to X/Open). On ncurses COLOR_PAIRS is always what's reported for the terminal via terminfo. How much you can actually address depends on the API used (COLOR_PAIR() vs. wattr_set() vs. int pointers).
I think ncurses and PDCurses/PDCursesMod are similar in that regard. In both, COLOR_PAIRS-1 is the maximum settable color pair via wattr_set().
In PDCurses*, that's also the limit for the COLOR_PAIR and PAIR_NUMBER macros. In ncurses, the limit for COLOR_PAIR and PAIR_NUMBER is 255 or COLOR_PAIRS-1, whichever is smaller.
It's unclear to me if the failure (in ncurses) of those macros for color pair indices beyond 255 is standards-compliant. But I'm reasonably sure that the standard does not _require_ those macros to fail for larger indices :
https://pubs.opengroup.org/onlinepubs/7908799/xcurses/COLOR_PAIR.html
So some ifdefing appears inevitable if you want to get the most out of your "color pair space".
Unfortunately, yes. Not a huge amount, but some. -- Bill
Best regards, Robin
