bug-ncurses
[Top][All Lists]
Advanced

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

Re: unable to set black text color for cdk


From: daggs
Subject: Re: unable to set black text color for cdk
Date: Thu, 2 Apr 2015 07:43:09 +0200


> 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)

> > as I see that all the other same combinations works ((n,n) for n:=1->7) and
> > it works when using special esc chars I can only assume that it is a either
> > ncurses or cdk limitation.
> 
> It's more cdk than ncurses in this case -- cdk's design tries to allocate
> more color pairs than the terminal supports.  Going past the maximum color
> pairs value doesn't work...
> 

I don't follow, if I run echo -e "\e[30;30mHello World" in the same session 
described above, I get hello world in black over the background image.
so if cdk allocates more color pairs than the terminal supports and the above 
shows that the terminal supports it, why running a loop on all colors and 
printing them to screen doesn't includes that option?
I'm attaching the example program I use.

Dagg

Attachment: cdk_colors.c
Description: Text document


reply via email to

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