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. More...
 
int init_pair (short pair, short fcol, short bcol)
 Initialise colour pair. More...
 
int pair_content (short pair, short *fcol, short *bcol)
 Get colours of colour pair. More...
 

Variables

static struct colour_pair cpairs [COLOUR_PAIRS]
 

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ colour_content()

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.

23  {
24  *red = ( ( colour & COLOUR_RED ) ? 1 : 0 );
25  *green = ( ( colour & COLOUR_GREEN ) ? 1 : 0 );
26  *blue = ( ( colour & COLOUR_BLUE ) ? 1 : 0 );
27  return OK;
28 }
#define COLOUR_RED
Definition: curses.h:185
Definition: sis900.h:208
#define COLOUR_GREEN
Definition: curses.h:186
#define colour
Colour for debug messages.
Definition: acpi.c:39
#define COLOUR_BLUE
Definition: curses.h:188

References colour, COLOUR_BLUE, COLOUR_GREEN, COLOUR_RED, and OK.

◆ init_pair()

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.

37  {
38  struct colour_pair *cpair;
39 
40  if ( ( pair < 1 ) || ( pair >= COLOUR_PAIRS ) )
41  return ERR;
42 
43  cpair = &cpairs[pair];
44  cpair->fcol = fcol;
45  cpair->bcol = bcol;
46  return OK;
47 }
#define COLOUR_PAIRS
Definition: curses.h:155
Definition: sis900.h:208
#define ERR
Definition: curses.h:18
short bcol
Definition: colour.c:7
short fcol
Definition: colour.c:6
static struct colour_pair cpairs[COLOUR_PAIRS]
Definition: colour.c:10

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

◆ pair_content()

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.

56  {
57  struct colour_pair *cpair;
58 
59  if ( ( pair < 0 ) || ( pair >= COLOUR_PAIRS ) )
60  return ERR;
61 
62  cpair = &cpairs[pair];
63  *fcol = cpair->fcol;
64  *bcol = cpair->bcol;
65  return OK;
66 }
#define COLOUR_PAIRS
Definition: curses.h:155
Definition: sis900.h:208
#define ERR
Definition: curses.h:18
short bcol
Definition: colour.c:7
short fcol
Definition: colour.c:6
static struct colour_pair cpairs[COLOUR_PAIRS]
Definition: colour.c:10

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

Variable Documentation

◆ cpairs

struct colour_pair cpairs[COLOUR_PAIRS]
static
Initial value:
= {
}
#define COLOUR_WHITE
Definition: curses.h:191
#define COLOUR_BLACK
Definition: curses.h:184

Definition at line 10 of file colour.c.

Referenced by init_pair(), and pair_content().