iPXE
ansicol.h
Go to the documentation of this file.
00001 #ifndef _IPXE_ANSICOL_H
00002 #define _IPXE_ANSICOL_H
00003 
00004 /** @file
00005  *
00006  * ANSI colours
00007  *
00008  */
00009 
00010 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
00011 
00012 #include <stdint.h>
00013 #include <curses.h> /* For COLOR_RED etc. */
00014 
00015 /** Default colour (usually white foreground, black background) */
00016 #define COLOUR_DEFAULT 9
00017 #define COLOR_DEFAULT COLOUR_DEFAULT
00018 
00019 /** Magic colour
00020  *
00021  * The magic basic colour is automatically remapped to the colour
00022  * stored in @c ansicol_magic.  This is used to allow the UI
00023  * background to automatically become transparent when a background
00024  * picture is used.
00025  */
00026 #define ANSICOL_MAGIC 15
00027 
00028 /** RGB value for "not defined" */
00029 #define ANSICOL_NO_RGB 0x01000000
00030 
00031 /**
00032  * @defgroup ansicolpairs ANSI colour pairs
00033  * @{
00034  */
00035 
00036 /** Default colour pair */
00037 #define CPAIR_DEFAULT 0
00038 
00039 /** Normal text */
00040 #define CPAIR_NORMAL 1
00041 
00042 /** Highlighted text */
00043 #define CPAIR_SELECT 2
00044 
00045 /** Unselectable text (e.g. continuation ellipses, menu separators) */
00046 #define CPAIR_SEPARATOR 3
00047 
00048 /** Editable text */
00049 #define CPAIR_EDIT 4
00050 
00051 /** Error text */
00052 #define CPAIR_ALERT 5
00053 
00054 /** URL text */
00055 #define CPAIR_URL 6
00056 
00057 /** PXE selected menu entry */
00058 #define CPAIR_PXE 7
00059 
00060 /** @} */
00061 
00062 /** An ANSI colour pair definition */
00063 struct ansicol_pair {
00064         /** Foreground colour index */
00065         uint8_t foreground;
00066         /** Background colour index */
00067         uint8_t background;
00068 } __attribute__ (( packed ));
00069 
00070 /* ansicol.c */
00071 extern void ansicol_set_pair ( unsigned int cpair );
00072 extern int ansicol_define_pair ( unsigned int cpair, unsigned int foreground,
00073                                  unsigned int background );
00074 
00075 /* ansicoldef.c */
00076 extern int ansicol_define ( unsigned int colour, unsigned int ansi,
00077                             uint32_t rgb );
00078 extern void ansicol_reset_magic ( void );
00079 extern void ansicol_set_magic_transparent ( void );
00080 
00081 /* Function provided by ansicol.c but overridden by ansicoldef.c, if present */
00082 extern void ansicol_set ( unsigned int colour, unsigned int which );
00083 
00084 #endif /* _IPXE_ANSICOL_H */