summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/weeconfig.c80
-rw-r--r--src/common/weeconfig.h3
-rw-r--r--src/gui/curses/gui-display.c11
-rw-r--r--src/irc/irc-nick.c3
-rw-r--r--src/irc/irc.h1
5 files changed, 89 insertions, 9 deletions
diff --git a/src/common/weeconfig.c b/src/common/weeconfig.c
index 6aeb9761f..6e0379812 100644
--- a/src/common/weeconfig.c
+++ b/src/common/weeconfig.c
@@ -70,6 +70,7 @@ char *cfg_look_charset_encode;
char *cfg_look_charset_internal;
char *cfg_look_buffer_timestamp;
int cfg_look_color_nicks;
+int cfg_look_color_nicks_number;
int cfg_look_color_actions;
int cfg_look_remove_colors_from_msgs;
int cfg_look_nicklist;
@@ -124,6 +125,10 @@ t_config_option weechat_options_look[] =
N_("display nick names with different colors"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
NULL, NULL, &cfg_look_color_nicks, NULL, config_change_noop },
+ { "look_color_nicks_number", N_("number of colors to use for nicks colors"),
+ N_("number of colors to use for nicks colors"),
+ OPTION_TYPE_INT, 1, 10, 10,
+ NULL, NULL, &cfg_look_color_nicks_number, NULL, config_change_nicks_colors },
{ "look_color_actions", N_("display actions with different colors"),
N_("display actions with different colors"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
@@ -229,6 +234,7 @@ int cfg_col_nick_voice;
int cfg_col_nick_more;
int cfg_col_nick_sep;
int cfg_col_nick_self;
+int cfg_col_nick_colors[COLOR_WIN_NICK_NUMBER];
int cfg_col_nick_private;
int cfg_col_nick_bg;
int cfg_col_dcc_selected;
@@ -415,6 +421,46 @@ t_config_option weechat_options_colors[] =
N_("color for local nick"),
OPTION_TYPE_COLOR, 0, 0, 0,
"white", NULL, &cfg_col_nick_self, NULL, &config_change_color },
+ { "col_nick_color1", N_("color for nick"),
+ N_("color for nick"),
+ OPTION_TYPE_COLOR, 0, 0, 0,
+ "cyan", NULL, &cfg_col_nick_colors[0], NULL, &config_change_color },
+ { "col_nick_color2", N_("color for nick"),
+ N_("color for nick"),
+ OPTION_TYPE_COLOR, 0, 0, 0,
+ "magenta", NULL, &cfg_col_nick_colors[1], NULL, &config_change_color },
+ { "col_nick_color3", N_("color for nick"),
+ N_("color for nick"),
+ OPTION_TYPE_COLOR, 0, 0, 0,
+ "green", NULL, &cfg_col_nick_colors[2], NULL, &config_change_color },
+ { "col_nick_color4", N_("color for nick"),
+ N_("color for nick"),
+ OPTION_TYPE_COLOR, 0, 0, 0,
+ "brown", NULL, &cfg_col_nick_colors[3], NULL, &config_change_color },
+ { "col_nick_color5", N_("color for nick"),
+ N_("color for nick"),
+ OPTION_TYPE_COLOR, 0, 0, 0,
+ "lightblue", NULL, &cfg_col_nick_colors[4], NULL, &config_change_color },
+ { "col_nick_color6", N_("color for nick"),
+ N_("color for nick"),
+ OPTION_TYPE_COLOR, 0, 0, 0,
+ "default", NULL, &cfg_col_nick_colors[5], NULL, &config_change_color },
+ { "col_nick_color7", N_("color for nick"),
+ N_("color for nick"),
+ OPTION_TYPE_COLOR, 0, 0, 0,
+ "lightcyan", NULL, &cfg_col_nick_colors[6], NULL, &config_change_color },
+ { "col_nick_color8", N_("color for nick"),
+ N_("color for nick"),
+ OPTION_TYPE_COLOR, 0, 0, 0,
+ "lightmagenta", NULL, &cfg_col_nick_colors[7], NULL, &config_change_color },
+ { "col_nick_color9", N_("color for nick"),
+ N_("color for nick"),
+ OPTION_TYPE_COLOR, 0, 0, 0,
+ "lightgreen", NULL, &cfg_col_nick_colors[8], NULL, &config_change_color },
+ { "col_nick_color10", N_("color for nick"),
+ N_("color for nick"),
+ OPTION_TYPE_COLOR, 0, 0, 0,
+ "blue", NULL, &cfg_col_nick_colors[9], NULL, &config_change_color },
{ "col_nick_private", N_("color for other nick in private window"),
N_("color for other nick in private window"),
OPTION_TYPE_COLOR, 0, 0, 0,
@@ -859,7 +905,41 @@ config_change_buffer_content ()
void
config_change_color ()
{
+ t_gui_window *ptr_win;
+
gui_init_colors ();
+ for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
+ gui_redraw_buffer (ptr_win->buffer);
+}
+
+/*
+ * config_change_nicks_colors: called when number of nicks color changed
+ */
+
+void
+config_change_nicks_colors ()
+{
+ t_irc_server *ptr_server;
+ t_irc_channel *ptr_channel;
+ t_irc_nick *ptr_nick;
+
+ for (ptr_server = irc_servers; ptr_server;
+ ptr_server = ptr_server->next_server)
+ {
+ if (ptr_server->is_connected)
+ {
+ for (ptr_channel = ptr_server->channels; ptr_channel;
+ ptr_channel = ptr_channel->next_channel)
+ {
+ for (ptr_nick = ptr_channel->nicks; ptr_nick;
+ ptr_nick = ptr_nick->next_nick)
+ {
+ if (ptr_nick->color != COLOR_WIN_NICK_SELF)
+ ptr_nick->color = nick_find_color (ptr_nick);
+ }
+ }
+ }
+ }
}
/*
diff --git a/src/common/weeconfig.h b/src/common/weeconfig.h
index 27119cc0b..024c7e542 100644
--- a/src/common/weeconfig.h
+++ b/src/common/weeconfig.h
@@ -87,6 +87,7 @@ extern char *cfg_look_charset_encode;
extern char *cfg_look_charset_internal;
extern char *cfg_look_buffer_timestamp;
extern int cfg_look_color_nicks;
+extern int cfg_look_color_nicks_number;
extern int cfg_look_color_actions;
extern int cfg_look_remove_colors_from_msgs;
extern int cfg_look_nicklist;
@@ -143,6 +144,7 @@ extern int cfg_col_nick_voice;
extern int cfg_col_nick_more;
extern int cfg_col_nick_sep;
extern int cfg_col_nick_self;
+extern int cfg_col_nick_colors[COLOR_WIN_NICK_NUMBER];
extern int cfg_col_nick_private;
extern int cfg_col_nick_bg;
extern int cfg_col_dcc_selected;
@@ -203,6 +205,7 @@ extern void config_change_title ();
extern void config_change_buffers ();
extern void config_change_buffer_content ();
extern void config_change_color ();
+extern void config_change_nicks_colors ();
extern void config_change_away_check ();
extern void config_change_fifo_pipe ();
extern void config_change_notify_levels ();
diff --git a/src/gui/curses/gui-display.c b/src/gui/curses/gui-display.c
index ef6a9d07e..e7e933ed3 100644
--- a/src/gui/curses/gui-display.c
+++ b/src/gui/curses/gui-display.c
@@ -60,10 +60,6 @@ t_gui_color gui_colors[] =
{ NULL, 0 }
};
-char *nicks_colors[COLOR_WIN_NICK_NUMBER] =
-{ "cyan", "magenta", "green", "brown", "lightblue", "default",
- "lightcyan", "lightmagenta", "lightgreen", "blue" };
-
int color_attr[NUM_COLORS];
@@ -2373,7 +2369,7 @@ gui_pre_init (int *argc, char **argv[])
void
gui_init_colors ()
{
- int i, color;
+ int i;
if (has_colors ())
{
@@ -2457,9 +2453,8 @@ gui_init_colors ()
for (i = 0; i < COLOR_WIN_NICK_NUMBER; i++)
{
- gui_assign_color (&color, nicks_colors[i]);
- init_pair (COLOR_WIN_NICK_FIRST + i, color, cfg_col_chat_bg);
- color_attr[COLOR_WIN_NICK_FIRST + i - 1] = (color >= 0) ? color & A_BOLD : 0;
+ init_pair (COLOR_WIN_NICK_FIRST + i, cfg_col_nick_colors[i], cfg_col_chat_bg);
+ color_attr[COLOR_WIN_NICK_FIRST + i - 1] = (cfg_col_nick_colors[i] >= 0) ? cfg_col_nick_colors[i] & A_BOLD : 0;
}
init_pair (COLOR_DCC_SELECTED,
diff --git a/src/irc/irc-nick.c b/src/irc/irc-nick.c
index 9d20d4ca8..615606e6e 100644
--- a/src/irc/irc-nick.c
+++ b/src/irc/irc-nick.c
@@ -30,6 +30,7 @@
#include "../common/weechat.h"
#include "irc.h"
+#include "../common/weeconfig.h"
/*
@@ -46,7 +47,7 @@ nick_find_color (t_irc_nick *nick)
{
color += (int)(nick->nick[i]);
}
- color = (color % COLOR_WIN_NICK_NUMBER);
+ color = (color % cfg_look_color_nicks_number);
return COLOR_WIN_NICK_FIRST + color;
}
diff --git a/src/irc/irc.h b/src/irc/irc.h
index 9ddbcb569..51696b5fd 100644
--- a/src/irc/irc.h
+++ b/src/irc/irc.h
@@ -342,6 +342,7 @@ extern void channel_print_log (t_irc_channel *);
/* nick functions (irc-nick.c) */
+extern int nick_find_color (t_irc_nick *);
extern t_irc_nick *nick_new (t_irc_channel *, char *, int, int, int, int, int);
extern void nick_resort (t_irc_channel *, t_irc_nick *);
extern void nick_change (t_irc_channel *, t_irc_nick *, char *);