[Top][All Lists]

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

Re: Strange behavior with color_content()

From: Thomas Dickey
Subject: Re: Strange behavior with color_content()
Date: Wed, 5 Feb 2020 20:39:04 -0500
User-agent: NeoMutt/20170113 (1.7.2)

On Wed, Feb 05, 2020 at 12:05:43PM -0600, Bryan Christ wrote:
> In order to find an unused color in the ncurses palette, I run a simple
> loop test looking for a free color.  The code is basically something like
> this:
> color_num = COLOR_WHITE + 1;    // skip built-in colors
> for(;;)
> {
>     color_content(color_num, &r, &g, &b);
>     if((r + g + b) == 0) break;
>     color_num++;
> }
> Now the odd thing is that this works except when the value of "color_num"
> is a multiple of 8.  When "color_num" is a multiple of 8, it incorrectly

if the special capability RGB is set, ncurses can make useful assumptions
about the color content.  If it's not set, ncurses can only assume ANSI
color palette (8 colors).

RGB is documented in user_caps:


For the latter,
that's in the curs_color manual page,
in the discussion of start_color:


Thomas E. Dickey <address@hidden>

Attachment: signature.asc
Description: PGP signature

reply via email to

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