1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-26 12:56:37 +02:00

Return empty string in API function weechat_color when color is unknown

This commit is contained in:
Sebastien Helleu
2010-10-29 23:21:57 +02:00
parent 804551122a
commit 90c99339b4
+18 -9
View File
@@ -208,23 +208,32 @@ gui_color_get_custom (const char *color_name)
{
fg = gui_color_search (str_fg);
bg = gui_color_search (pos_bg);
snprintf (color[index_color], sizeof (color[index_color]),
"%s*%02d,%02d",
GUI_COLOR_COLOR_STR, fg, bg);
if ((fg >= 0) && (bg >= 0))
{
snprintf (color[index_color], sizeof (color[index_color]),
"%s*%02d,%02d",
GUI_COLOR_COLOR_STR, fg, bg);
}
}
else if (str_fg && !pos_bg)
{
fg = gui_color_search (str_fg);
snprintf (color[index_color], sizeof (color[index_color]),
"%sF%02d",
GUI_COLOR_COLOR_STR, fg);
if (fg >= 0)
{
snprintf (color[index_color], sizeof (color[index_color]),
"%sF%02d",
GUI_COLOR_COLOR_STR, fg);
}
}
else if (!str_fg && pos_bg)
{
bg = gui_color_search (pos_bg);
snprintf (color[index_color], sizeof (color[index_color]),
"%sB%02d",
GUI_COLOR_COLOR_STR, bg);
if (bg >= 0)
{
snprintf (color[index_color], sizeof (color[index_color]),
"%sB%02d",
GUI_COLOR_COLOR_STR, bg);
}
}
if (str_fg)