First of all, congratulations. PDCurses is a great stuff.
I would like to get the foreground and backuground colors for a specified screen position.
I tried to do a mvinch(), getting a chtype. But what should I do for getting the colors? I could not find any examples about.
I'm currently using MinGW under Win2k.
1. int attr_get(attr_t *attrs, short *pair, void *opts);
2. int pair_content(short pair, short *f, short *b);
First find out the color pair, then find out what
the color pair represents (foreground and
background). I haven't tested pdcurses in this,
but this works for ncurses.
Not attr_get() -- that's for the current attribute rather than the attribute at a given position.
You can get the pair number via the PAIR_NUMBER() macro. So...
short fg, bg;
chtype ch = mvinch(y, x);
pair_content(PAIR_NUMBER(ch), &fg, &bg);
Thanks to Warren and William.
In fact, William's hint solves my problem.
Thanks, guys. Keep your good job.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.