1 /** 2 * @file color.h 3 * @author Joe Wingbermuehle 4 * @date 2004-2006 5 * 6 * @brief Functions to handle loading colors. 7 * 8 */ 9 10 #ifndef COLOR_H 11 #define COLOR_H 12 13 /** Enumeration of colors used for various JWM components. 14 * For easier parsing, tray components must all have colors ordered the 15 * same way as COLOR_TRAY_*. 16 */ 17 typedef unsigned char ColorType; 18 #define COLOR_TITLE_FG 0 19 #define COLOR_TITLE_ACTIVE_FG 1 20 #define COLOR_TITLE_BG1 2 21 #define COLOR_TITLE_BG2 3 22 #define COLOR_TITLE_ACTIVE_BG1 4 23 #define COLOR_TITLE_ACTIVE_BG2 5 24 #define COLOR_TRAY_FG 6 25 #define COLOR_TRAY_BG1 7 26 #define COLOR_TRAY_BG2 8 27 #define COLOR_TRAY_ACTIVE_FG 9 28 #define COLOR_TRAY_ACTIVE_BG1 10 29 #define COLOR_TRAY_ACTIVE_BG2 11 30 #define COLOR_TRAY_UP 12 31 #define COLOR_TRAY_DOWN 13 32 #define COLOR_TRAY_ACTIVE_UP 14 33 #define COLOR_TRAY_ACTIVE_DOWN 15 34 #define COLOR_TASKLIST_FG 16 35 #define COLOR_TASKLIST_BG1 17 36 #define COLOR_TASKLIST_BG2 18 37 #define COLOR_TASKLIST_ACTIVE_FG 19 38 #define COLOR_TASKLIST_ACTIVE_BG1 20 39 #define COLOR_TASKLIST_ACTIVE_BG2 21 40 #define COLOR_TASKLIST_UP 22 41 #define COLOR_TASKLIST_DOWN 23 42 #define COLOR_TASKLIST_ACTIVE_UP 24 43 #define COLOR_TASKLIST_ACTIVE_DOWN 25 44 #define COLOR_TRAYBUTTON_FG 26 45 #define COLOR_TRAYBUTTON_BG1 27 46 #define COLOR_TRAYBUTTON_BG2 28 47 #define COLOR_TRAYBUTTON_ACTIVE_FG 29 48 #define COLOR_TRAYBUTTON_ACTIVE_BG1 30 49 #define COLOR_TRAYBUTTON_ACTIVE_BG2 31 50 #define COLOR_TRAYBUTTON_UP 32 51 #define COLOR_TRAYBUTTON_DOWN 33 52 #define COLOR_TRAYBUTTON_ACTIVE_UP 34 53 #define COLOR_TRAYBUTTON_ACTIVE_DOWN 35 54 #define COLOR_PAGER_BG 36 55 #define COLOR_PAGER_FG 37 56 #define COLOR_PAGER_ACTIVE_BG 38 57 #define COLOR_PAGER_ACTIVE_FG 39 58 #define COLOR_PAGER_OUTLINE 40 59 #define COLOR_PAGER_TEXT 41 60 #define COLOR_MENU_BG 42 61 #define COLOR_MENU_FG 43 62 #define COLOR_MENU_UP 44 63 #define COLOR_MENU_DOWN 45 64 #define COLOR_MENU_ACTIVE_BG1 46 65 #define COLOR_MENU_ACTIVE_BG2 47 66 #define COLOR_MENU_ACTIVE_FG 48 67 #define COLOR_MENU_ACTIVE_UP 49 68 #define COLOR_MENU_ACTIVE_DOWN 50 69 #define COLOR_POPUP_BG 51 70 #define COLOR_POPUP_FG 52 71 #define COLOR_POPUP_OUTLINE 53 72 #define COLOR_TITLE_UP 54 73 #define COLOR_TITLE_DOWN 55 74 #define COLOR_TITLE_ACTIVE_UP 56 75 #define COLOR_TITLE_ACTIVE_DOWN 57 76 #define COLOR_CLOCK_FG 58 77 #define COLOR_CLOCK_BG1 59 78 #define COLOR_CLOCK_BG2 60 79 #define COLOR_COUNT 61 80 81 extern unsigned long colors[COLOR_COUNT]; 82 83 /*@{*/ 84 #define InitializeColors() (void)(0) 85 void StartupColors(void); 86 void ShutdownColors(void); 87 void DestroyColors(void); 88 /*@}*/ 89 90 /** Set the color to use for a component. 91 * @param c The component whose color to set. 92 * @param value The color to use. 93 */ 94 void SetColor(ColorType c, const char *value); 95 96 /** Parse a color. 97 * @param value The color name or hex value. 98 * @param c The color return value (with pixel and components filled). 99 * @return 1 on success, 0 on failure. 100 */ 101 char ParseColor(const char *value, XColor *c); 102 103 /** Get the color pixel from red, green, and blue values. 104 * @param c The structure containing the rgb values and the pixel value. 105 */ 106 void GetColor(XColor *c); 107 108 #ifdef USE_XFT 109 /** Get an XFT color. 110 * @param type The color whose XFT color to get. 111 * @return The XFT color. 112 */ 113 XftColor *GetXftColor(ColorType type); 114 #endif 115 116 #endif /* COLOR_H */ 117