summaryrefslogtreecommitdiff
path: root/src/gui/gui-color.h
blob: bc7464f45760b0fa63a0ed2ee0dbf5bcad4406e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
/*
 * Copyright (c) 2003-2008 by FlashCode <flashcode@flashtux.org>
 * See README for License detail, AUTHORS for developers list.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */


#ifndef __WEECHAT_GUI_COLOR_H
#define __WEECHAT_GUI_COLOR_H 1

#define GUI_COLOR_NICK_NUMBER 10

enum t_gui_color_enum
{
    GUI_COLOR_SEPARATOR = 0,
    
    GUI_COLOR_TITLE,
    
    GUI_COLOR_CHAT,
    GUI_COLOR_CHAT_TIME,
    GUI_COLOR_CHAT_TIME_DELIMITERS,
    GUI_COLOR_CHAT_PREFIX_ERROR,
    GUI_COLOR_CHAT_PREFIX_NETWORK,
    GUI_COLOR_CHAT_PREFIX_ACTION,
    GUI_COLOR_CHAT_PREFIX_JOIN,
    GUI_COLOR_CHAT_PREFIX_QUIT,
    GUI_COLOR_CHAT_PREFIX_MORE,
    GUI_COLOR_CHAT_PREFIX_SUFFIX,
    GUI_COLOR_CHAT_BUFFER,
    GUI_COLOR_CHAT_SERVER,
    GUI_COLOR_CHAT_CHANNEL,
    GUI_COLOR_CHAT_NICK,
    GUI_COLOR_CHAT_NICK_SELF,
    GUI_COLOR_CHAT_NICK_OTHER,
    GUI_COLOR_CHAT_NICK1,
    GUI_COLOR_CHAT_NICK2,
    GUI_COLOR_CHAT_NICK3,
    GUI_COLOR_CHAT_NICK4,
    GUI_COLOR_CHAT_NICK5,
    GUI_COLOR_CHAT_NICK6,
    GUI_COLOR_CHAT_NICK7,
    GUI_COLOR_CHAT_NICK8,
    GUI_COLOR_CHAT_NICK9,
    GUI_COLOR_CHAT_NICK10,
    GUI_COLOR_CHAT_HOST,
    GUI_COLOR_CHAT_DELIMITERS,
    GUI_COLOR_CHAT_HIGHLIGHT,
    GUI_COLOR_CHAT_READ_MARKER,
    
    GUI_COLOR_STATUS,
    GUI_COLOR_STATUS_DELIMITERS,
    GUI_COLOR_STATUS_NUMBER,
    GUI_COLOR_STATUS_CATEGORY,
    GUI_COLOR_STATUS_NAME,
    GUI_COLOR_STATUS_DATA_MSG,
    GUI_COLOR_STATUS_DATA_PRIVATE,
    GUI_COLOR_STATUS_DATA_HIGHLIGHT,
    GUI_COLOR_STATUS_DATA_OTHER,
    GUI_COLOR_STATUS_MORE,
    
    GUI_COLOR_INPUT,
    GUI_COLOR_INPUT_SERVER,
    GUI_COLOR_INPUT_CHANNEL,
    GUI_COLOR_INPUT_NICK,
    GUI_COLOR_INPUT_DELIMITERS,
    GUI_COLOR_INPUT_TEXT_NOT_FOUND,
    GUI_COLOR_INPUT_ACTIONS,
    
    GUI_COLOR_NICKLIST,
    GUI_COLOR_NICKLIST_GROUP,
    GUI_COLOR_NICKLIST_AWAY,
    GUI_COLOR_NICKLIST_PREFIX1,
    GUI_COLOR_NICKLIST_PREFIX2,
    GUI_COLOR_NICKLIST_PREFIX3,
    GUI_COLOR_NICKLIST_PREFIX4,
    GUI_COLOR_NICKLIST_PREFIX5,
    GUI_COLOR_NICKLIST_MORE,
    GUI_COLOR_NICKLIST_SEPARATOR,
    
    /* number of colors */
    GUI_COLOR_NUM_COLORS,
};

/* WeeChat internal color attributes (should never be in protocol messages) */

#define GUI_COLOR_COLOR_CHAR           '\x19'
#define GUI_COLOR_COLOR_STR            "\x19"
#define GUI_COLOR_SET_WEECHAT_CHAR     '\x1A'
#define GUI_COLOR_SET_WEECHAT_STR      "\x1A"
#define GUI_COLOR_REMOVE_WEECHAT_CHAR  '\x1B'
#define GUI_COLOR_REMOVE_WEECHAT_STR   "\x1B"
#define GUI_COLOR_RESET_CHAR           '\x1C'
#define GUI_COLOR_RESET_STR            "\x1C"

#define GUI_COLOR_ATTR_BOLD_CHAR       '\x01'
#define GUI_COLOR_ATTR_BOLD_STR        "\x01"
#define GUI_COLOR_ATTR_REVERSE_CHAR    '\x02'
#define GUI_COLOR_ATTR_REVERSE_STR     "\x02"
#define GUI_COLOR_ATTR_ITALIC_CHAR     '\x03'
#define GUI_COLOR_ATTR_ITALIC_STR      "\x03"
#define GUI_COLOR_ATTR_UNDERLINE_CHAR  '\x04'
#define GUI_COLOR_ATTR_UNDERLINE_STR   "\x04"

#define GUI_COLOR(color) ((gui_color[color]) ? gui_color[color]->string : "")
#define GUI_NO_COLOR     GUI_COLOR_RESET_STR

#define GUI_COLOR_CUSTOM_BAR_FG    (gui_color_get_custom ("bar_fg"))
#define GUI_COLOR_CUSTOM_BAR_DELIM (gui_color_get_custom ("bar_delim"))
#define GUI_COLOR_CUSTOM_BAR_BG    (gui_color_get_custom ("bar_bg"))

#define GUI_COLOR_FG_CHAR              'F'
#define GUI_COLOR_FG_STR               "F"
#define GUI_COLOR_BG_CHAR              'B'
#define GUI_COLOR_BG_STR               "B"
#define GUI_COLOR_FG_BG_CHAR           '*'
#define GUI_COLOR_FG_BG_STR            "*"
#define GUI_COLOR_BAR_CHAR             'b'
#define GUI_COLOR_BAR_STR              "b"
#define GUI_COLOR_BAR_FG_CHAR          'F'
#define GUI_COLOR_BAR_FG_STR           "F"
#define GUI_COLOR_BAR_DELIM_CHAR       'D'
#define GUI_COLOR_BAR_DELIM_STR        "D"
#define GUI_COLOR_BAR_BG_CHAR          'B'
#define GUI_COLOR_BAR_BG_STR           "B"
#define GUI_COLOR_BAR_MOVE_CURSOR_CHAR '#'
#define GUI_COLOR_BAR_MOVE_CURSOR_STR  "#"

/* color structure */

struct t_gui_color
{
    int foreground;                 /* foreground color                     */
    int background;                 /* background color                     */
    int attributes;                 /* attributes (bold, ..)                */
    char *string;                   /* WeeChat color: "\x19??", ?? is #color*/
};

/* color variables */

extern struct t_gui_color *gui_color[];

/* color functions */

extern int gui_color_search_config_int (const char *color_name);
extern char *gui_color_search_config_str (int color_number);
extern char *gui_color_get_custom (const char *color_name);
extern unsigned char *gui_color_decode (const unsigned char *string);
extern void gui_color_free (struct t_gui_color *color);

/* color functions (GUI dependent) */

extern int gui_color_search (const char *color_name);
extern int gui_color_assign (int *color, char const *color_name);
extern int gui_color_get_number ();
extern char *gui_color_get_name (int num_color);
extern void gui_color_init_pairs ();
extern void gui_color_init_weechat ();

#endif /* gui-color.h */