iPXE
Data Structures | Functions | Variables
colour.c File Reference
#include <curses.h>

Go to the source code of this file.

Data Structures

struct  colour_pair

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
int colour_content (short colour, short *red, short *green, short *blue)
 Identify the RGB components of a given colour value.
int init_pair (short pair, short fcol, short bcol)
 Initialise colour pair.
int pair_content (short pair, short *fcol, short *bcol)
 Get colours of colour pair.

Variables

static struct colour_pair cpairs [COLOUR_PAIRS]

Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
int colour_content ( short  colour,
short *  red,
short *  green,
short *  blue 
)

Identify the RGB components of a given colour value.

Parameters:
colourcolour value
*redaddress to store red component
*greenaddress to store green component
*blueaddress to store blue component
Return values:
rcreturn status code

Definition at line 23 of file colour.c.

References COLOUR_BLUE, COLOUR_GREEN, COLOUR_RED, and OK.

                                                                           {
        *red = ( ( colour & COLOUR_RED ) ? 1 : 0 );
        *green = ( ( colour & COLOUR_GREEN ) ? 1 : 0 );
        *blue = ( ( colour & COLOUR_BLUE ) ? 1 : 0 );
        return OK;
}
int init_pair ( short  pair,
short  fcol,
short  bcol 
)

Initialise colour pair.

Parameters:
paircolour pair number
fcolforeground colour
bcolbackground colour

Definition at line 37 of file colour.c.

References colour_pair::bcol, COLOUR_PAIRS, ERR, colour_pair::fcol, and OK.

                                                     {
        struct colour_pair *cpair;

        if ( ( pair < 1 ) || ( pair >= COLOUR_PAIRS ) )
                return ERR;
        
        cpair = &cpairs[pair];
        cpair->fcol = fcol;
        cpair->bcol = bcol;
        return OK;
}
int pair_content ( short  pair,
short *  fcol,
short *  bcol 
)

Get colours of colour pair.

Parameters:
paircolour pair number
Return values:
fcolforeground colour
bcolbackground colour

Definition at line 56 of file colour.c.

References colour_pair::bcol, COLOUR_PAIRS, ERR, colour_pair::fcol, and OK.

                                                          {
        struct colour_pair *cpair;

        if ( ( pair < 0 ) || ( pair >= COLOUR_PAIRS ) )
                return ERR;
        
        cpair = &cpairs[pair];
        *fcol = cpair->fcol;
        *bcol = cpair->bcol;
        return OK;
}

Variable Documentation

struct colour_pair cpairs[COLOUR_PAIRS] [static]
Initial value:
 {
        [0] = { COLOUR_WHITE, COLOUR_BLACK },
}

Definition at line 10 of file colour.c.