|
NAMEalloc_pair, find_pair, free_pair - new curses color-pair functionsSYNOPSIS#include <ncurses/curses.h>int alloc_pair(int fg, int bg);
DESCRIPTIONThese functions are an extension to the curses library. They permit an application to dynamically allocate a color pair using the foreground/background colors rather than assign a fixed color pair number, and return an unused pair to the pool.The number of colors may be related to the number of possible color pairs for a given terminal, or it may not:
alloc_pairThe alloc_pair function accepts parameters for foreground and background color, and checks if that color combination is already associated with a color pair.
All of the color pairs are allocated from a table of possible color pairs. The size of the table is determined by the terminfo pairs capability. The table is shared with init_pair; in fact alloc_pair calls init_pair after updating the ncurses library's fast index to the colors versus color pairs. find_pairThe find_pair function accepts parameters for foreground and background color, and checks if that color combination is already associated with a color pair, returning the pair number if it has been allocated. Otherwise it returns -1.free_pairMarks the given color pair as unused, i.e., like color pair 0.RETURN VALUEThe alloc_pair function returns a color pair number in the range 1 through COLOR_PAIRS-1, unless it encounters an error updating its fast index to the color pair values, preventing it from allocating a color pair. In that case, it returns -1.The find_pair function returns a color pair number if the given color combination has been associated with a color pair, or -1 if not. Likewise, free_pair returns OK unless it encounters an error updating the fast index or if no such color pair is in use. PORTABILITYThese routines are specific to ncurses. They were not supported on Version 7, BSD or System V implementations. It is recommended that any code depending on them be conditioned using NCURSES_VERSION.SEE ALSOcurs_color(3X).AUTHORThomas Dickey. Visit the GSP FreeBSD Man Page Interface. |