Merge branch '132_search_skip_hidden'
[midnight-commander.git] / src / color.h
blob0597870a11b6c7c72ca37029316ece7dbc152504
1 #ifndef MC_COLOR_H
2 #define MC_COLOR_H
4 extern int use_colors;
5 extern int disable_colors;
7 extern int attr_pairs [];
8 #ifdef HAVE_SLANG
9 # define MY_COLOR_PAIR(x) COLOR_PAIR(x)
10 #else
11 # define MY_COLOR_PAIR(x) (COLOR_PAIR(x) | attr_pairs [x])
12 #endif
14 #define IF_COLOR(co,bw) (use_colors ? MY_COLOR_PAIR(co) : bw)
16 /* Beware! When using Slang with color, not all the indexes are free.
17 See myslang.h (A_*) */
18 #define NORMAL_COLOR IF_COLOR (1, 0)
19 #define SELECTED_COLOR IF_COLOR (2, A_REVERSE)
20 #define MARKED_COLOR IF_COLOR (3, A_BOLD)
22 #ifdef HAVE_SLANG
23 #define MARKED_SELECTED_COLOR IF_COLOR (4, (SLtt_Use_Ansi_Colors ? A_BOLD_REVERSE : A_REVERSE | A_BOLD))
24 #else
25 #define MARKED_SELECTED_COLOR IF_COLOR (4, A_REVERSE | A_BOLD)
26 #endif
28 #define ERROR_COLOR IF_COLOR (5, A_BOLD)
29 #define MENU_ENTRY_COLOR IF_COLOR (6, A_REVERSE)
30 #define REVERSE_COLOR IF_COLOR (7, A_REVERSE)
32 extern int dialog_colors[4];
33 extern int alarm_colors[4];
35 /* Dialog colors */
36 #define COLOR_NORMAL IF_COLOR (8, A_REVERSE)
37 #define COLOR_FOCUS IF_COLOR (9, A_BOLD)
38 #define COLOR_HOT_NORMAL IF_COLOR (10, 0)
39 #define COLOR_HOT_FOCUS IF_COLOR (11, 0)
41 #define VIEW_UNDERLINED_COLOR IF_COLOR (12, A_UNDERLINE)
42 #define MENU_SELECTED_COLOR IF_COLOR (13, A_BOLD)
43 #define MENU_HOT_COLOR IF_COLOR (14, 0)
44 #define MENU_HOTSEL_COLOR IF_COLOR (15, 0)
46 #define HELP_NORMAL_COLOR IF_COLOR (16, A_REVERSE)
47 #define HELP_ITALIC_COLOR IF_COLOR (17, A_REVERSE)
48 #define HELP_BOLD_COLOR IF_COLOR (18, A_REVERSE)
49 #define HELP_LINK_COLOR IF_COLOR (19, 0)
50 #define HELP_SLINK_COLOR IF_COLOR (20, A_BOLD)
53 * This should be selectable independently. Default has to be black background
54 * foreground does not matter at all.
56 #define GAUGE_COLOR IF_COLOR (21, 0)
57 #define INPUT_COLOR IF_COLOR (22, 0)
59 /* Add this to color panel, on BW all pairs are normal */
60 #define DIRECTORY_COLOR IF_COLOR (23, 0)
61 #define EXECUTABLE_COLOR IF_COLOR (24, 0)
62 #define LINK_COLOR IF_COLOR (25, 0)
63 #define STALE_LINK_COLOR IF_COLOR (26, 0)
64 #define DEVICE_COLOR IF_COLOR (27, 0)
65 #define SPECIAL_COLOR IF_COLOR (28, 0)
66 #define CORE_COLOR IF_COLOR (29, 0)
69 /* For the default color any unused index may be chosen. */
70 #define DEFAULT_COLOR_INDEX 30
71 #define DEFAULT_COLOR IF_COLOR (DEFAULT_COLOR_INDEX, 0)
74 * editor colors - only 4 for normal, search->found, select, and whitespace
75 * respectively
76 * Last is defined to view color.
78 #define EDITOR_NORMAL_COLOR_INDEX 34
79 #define EDITOR_NORMAL_COLOR IF_COLOR (EDITOR_NORMAL_COLOR_INDEX, 0)
80 #define EDITOR_BOLD_COLOR IF_COLOR (35, A_BOLD)
81 #define EDITOR_MARKED_COLOR IF_COLOR (36, A_REVERSE)
82 #define EDITOR_WHITESPACE_COLOR IF_COLOR (37, 0 /* irrelevant */)
84 /* Error dialog colors */
85 #define ERROR_HOT_NORMAL IF_COLOR (38, 0)
86 #define ERROR_HOT_FOCUS IF_COLOR (39, 0)
88 #ifdef HAVE_SLANG
89 # define CTYPE const char *
90 #else
91 # define CTYPE int
92 #endif
94 void init_colors (void);
95 void done_colors (void);
96 void mc_init_pair (int index, CTYPE foreground, CTYPE background);
97 int try_alloc_color_pair (const char *fg, const char *bg);
99 #endif