[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: unable to set black text color for cdk
From: |
Thomas Dickey |
Subject: |
Re: unable to set black text color for cdk |
Date: |
Tue, 2 Jun 2015 21:24:58 -0400 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
On Thu, May 28, 2015 at 01:43:49PM +0200, daggs wrote:
> Greeting Thomas
>
> > Sent: Thursday, April 02, 2015 at 12:28 PM
> > From: "Thomas Dickey" <address@hidden>
> > To: daggs <address@hidden>
> > Cc: address@hidden
> > Subject: Re: unable to set black text color for cdk
> >
> > On Thu, Apr 02, 2015 at 07:43:09AM +0200, daggs wrote:
> > >
> > >
> > > > Sent: Thursday, April 02, 2015 at 4:01 AM
> > > > From: "Thomas Dickey" <address@hidden>
> > > > To: daggs <address@hidden>
> > > > Cc: address@hidden
> > > > Subject: Re: unable to set black text color for cdk
> > > >
> > > > On Wed, Apr 01, 2015 at 10:50:26AM +0200, daggs wrote:
> > > > >
> > > > >
> > > > > > Sent: Wednesday, April 01, 2015 at 3:54 AM
> > > > > > From: "Thomas Dickey" <address@hidden>
> > > > > > To: daggs <address@hidden>
> > > > > > Cc: address@hidden
> > > > > > Subject: Re: unable to set black text color for cdk
> > > > > >
> > > > > > On Mon, Mar 30, 2015 at 12:31:33PM +0200, daggs wrote:
> > > > > > > Greetings,
> > > > > > >
> > > > > > > I'm trying to setup a text in black color and it ends up in gray,
> > > > > > > looping
> > > > > > > over the first 49 colors (with and without bold) didn't returned
> > > > > > > any label
> > > > > > > with black text color, is it possible that there is no black
> > > > > > > color text in
> > > > > > > cdk?
> > > > > >
> > > > > > hmm - it's more complicated than that - partly Cdk and partly
> > > > > > (n)curses.
> > > > > >
> > > > > > The initCDKColor function is probably what you're looking at, since
> > > > > > it is the only place that calls init_pair(). It's a little odd (I
> > > > > > think)
> > > > > > because it maps the colors 0-7 in this order:
> > > > > >
> > > > > > COLOR_WHITE, COLOR_RED, COLOR_GREEN,
> > > > > > COLOR_YELLOW, COLOR_BLUE, COLOR_MAGENTA,
> > > > > > COLOR_CYAN, COLOR_BLACK
> > > > > >
> > > > > > If the terminal supports more than 8, cdk uses only 8. You can
> > > > > > always
> > > > > > override that by calling init_pair() in your application.
> > > > > >
> > > > > > Normally in curses, black is zero. That raises a point, i.e., that
> > > > > > color
> > > > > > pair 0 is special in curses (no colors as such). So cdk does not
> > > > > > use that.
> > > > > >
> > > > > > In any case, since black is last, you would see black text on pairs
> > > > > > 57-64,
> > > > > > due to the way the loops are ordered.
> > > > >
> > > > > Greeting Thomas,
> > > > >
> > > > > my issue in fact is with the (0,0) pair, e.g. black text over black
> > > > > background.
> > > > > you might ask why one need such option, well using black background
> > > > > color ober a background image gives me a transparency affect.
> > > > > for example, I want to create a background image that has a white
> > > > > square in it and write inside it text.
> > > >
> > > > I see. I think the issue is that Cdk is putting black-on-black in the
> > > > last
> > > > color pair which it requests -- the 65th slot. However, for an 8-color
> > > > terminal, the description would say the terminal supports only 64 = 8*8
> > > > color pairs.
> > > >
> > >
> > > tried to print the 65th color, the it was the same like the 64th color
> > > (no change)
> >
> > But ncurses only uses 0 through 63
> >
> > See attached sample testcase and debugging trace -- look at the return
> > values
> > from init_pair().
> >
>
> sorry it took so long to answer, I was reassigned to another project for a
> while.
>
> according to the trace in the case you've provided I see that the valid
> colors range from 1 to 80 (including).
> running a matching test on that range return a "hit" for pair 64, however,
> the color on screen stays the same.
> running the same matching test on a range from 0 to 63 return a "hit" for
> pair 0 (which you claim to be invalid). however, the color on screen stays
> the same.
>
> so I want to understand what exactly is the right colors range.
That is 0 .. PAIRS-1
(zero up to one less than the number of color pairs in the terminal
description).
That's because -- even though it is tempting to consider zero as a special
case that would just shift everything up -- the color pair is stored as
an unsigned value in a bit-field in chtype's for instance. ncurses allows
8 bits for that in ncurses5 (ncurses6 will allow 16 bits).
--
Thomas E. Dickey <address@hidden>
http://invisible-island.net
ftp://invisible-island.net
signature.asc
Description: Digital signature
- Re: unable to set black text color for cdk,
Thomas Dickey <=