iPXE
ansicol.h
Go to the documentation of this file.
1 #ifndef _IPXE_ANSICOL_H
2 #define _IPXE_ANSICOL_H
3 
4 /** @file
5  *
6  * ANSI colours
7  *
8  */
9 
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11 
12 #include <stdint.h>
13 #include <curses.h> /* For COLOR_RED etc. */
14 
15 /** Default colour (usually white foreground, black background) */
16 #define COLOUR_DEFAULT 9
17 #define COLOR_DEFAULT COLOUR_DEFAULT
18 
19 /** Magic colour
20  *
21  * The magic basic colour is automatically remapped to the colour
22  * stored in @c ansicol_magic. This is used to allow the UI
23  * background to automatically become transparent when a background
24  * picture is used.
25  */
26 #define ANSICOL_MAGIC 15
27 
28 /** RGB value for "not defined" */
29 #define ANSICOL_NO_RGB 0x01000000
30 
31 /**
32  * @defgroup ansicolpairs ANSI colour pairs
33  * @{
34  */
35 
36 /** Default colour pair */
37 #define CPAIR_DEFAULT 0
38 
39 /** Normal text */
40 #define CPAIR_NORMAL 1
41 
42 /** Highlighted text */
43 #define CPAIR_SELECT 2
44 
45 /** Unselectable text (e.g. continuation ellipses, menu separators) */
46 #define CPAIR_SEPARATOR 3
47 
48 /** Editable text */
49 #define CPAIR_EDIT 4
50 
51 /** Error text */
52 #define CPAIR_ALERT 5
53 
54 /** URL text */
55 #define CPAIR_URL 6
56 
57 /** PXE selected menu entry */
58 #define CPAIR_PXE 7
59 
60 /** @} */
61 
62 /** An ANSI colour pair definition */
63 struct ansicol_pair {
64  /** Foreground colour index */
66  /** Background colour index */
68 } __attribute__ (( packed ));
69 
70 /* ansicol.c */
71 extern void ansicol_set_pair ( unsigned int cpair );
72 extern int ansicol_define_pair ( unsigned int cpair, unsigned int foreground,
73  unsigned int background );
74 
75 /* ansicoldef.c */
76 extern int ansicol_define ( unsigned int colour, unsigned int ansi,
77  uint32_t rgb );
78 extern void ansicol_reset_magic ( void );
79 extern void ansicol_set_magic_transparent ( void );
80 
81 /* Function provided by ansicol.c but overridden by ansicoldef.c, if present */
82 extern void ansicol_set ( unsigned int colour, unsigned int which );
83 
84 #endif /* _IPXE_ANSICOL_H */
MuCurses header file.
#define __attribute__(x)
Definition: compiler.h:10
void ansicol_reset_magic(void)
Reset magic colour.
Definition: ansicoldef.c:179
uint8_t foreground
Foreground colour index.
Definition: ansicol.h:65
int ansicol_define(unsigned int colour, unsigned int ansi, uint32_t rgb)
Define ANSI colour.
Definition: ansicoldef.c:125
void ansicol_set(unsigned int colour, unsigned int which)
Set ANSI colour (when no colour definition support is present)
Definition: ansicol.c:57
#define colour
Colour for debug messages.
Definition: init.c:40
An ANSI colour pair definition.
Definition: ansicol.h:63
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
void ansicol_set_pair(unsigned int cpair)
Set ANSI foreground and background colour.
Definition: ansicol.c:89
int ansicol_define_pair(unsigned int cpair, unsigned int foreground, unsigned int background)
Define ANSI colour pair.
Definition: ansicol.c:110
unsigned char uint8_t
Definition: stdint.h:10
unsigned int uint32_t
Definition: stdint.h:12
void ansicol_set_magic_transparent(void)
Set magic colour to transparent.
Definition: ansicoldef.c:189
uint8_t background
Background colour index.
Definition: ansicol.h:67