summaryrefslogtreecommitdiff
path: root/src/gui/gui-color.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/gui-color.c')
-rw-r--r--src/gui/gui-color.c60
1 files changed, 28 insertions, 32 deletions
diff --git a/src/gui/gui-color.c b/src/gui/gui-color.c
index b2721c552..c895d5e7c 100644
--- a/src/gui/gui-color.c
+++ b/src/gui/gui-color.c
@@ -1351,14 +1351,13 @@ gui_color_encode_ansi (const char *string)
if (error && !error[0])
{
ansi_color = gui_color_weechat_to_ansi (color);
- if (ansi_color >= 0)
- {
- snprintf (str_concat, sizeof (str_concat),
- "\x1B[%dm",
- (ansi_color < 8) ?
- ansi_color + 30 : ansi_color - 8 + 90);
- string_dyn_concat (out, str_concat, -1);
- }
+ snprintf (str_concat, sizeof (str_concat),
+ "\x1B[%dm",
+ (ansi_color < 0) ?
+ GUI_COLOR_ANSI_DEFAULT_FG :
+ ((ansi_color < 8) ?
+ ansi_color + 30 : ansi_color - 8 + 90));
+ string_dyn_concat (out, str_concat, -1);
}
ptr_string += 2;
}
@@ -1397,14 +1396,13 @@ gui_color_encode_ansi (const char *string)
if (error && !error[0])
{
ansi_color = gui_color_weechat_to_ansi (color);
- if (ansi_color >= 0)
- {
- snprintf (str_concat, sizeof (str_concat),
- "\x1B[%dm",
- (ansi_color < 8) ?
- ansi_color + 40 : ansi_color - 8 + 100);
- string_dyn_concat (out, str_concat, -1);
- }
+ snprintf (str_concat, sizeof (str_concat),
+ "\x1B[%dm",
+ (ansi_color < 0) ?
+ GUI_COLOR_ANSI_DEFAULT_BG :
+ ((ansi_color < 8) ?
+ ansi_color + 40 : ansi_color - 8 + 100));
+ string_dyn_concat (out, str_concat, -1);
}
ptr_string += 2;
}
@@ -1453,14 +1451,13 @@ gui_color_encode_ansi (const char *string)
if (error && !error[0])
{
ansi_color = gui_color_weechat_to_ansi (color);
- if (ansi_color >= 0)
- {
- snprintf (str_concat, sizeof (str_concat),
- "\x1B[%dm",
- (ansi_color < 8) ?
- ansi_color + 30 : ansi_color - 8 + 90);
- string_dyn_concat (out, str_concat, -1);
- }
+ snprintf (str_concat, sizeof (str_concat),
+ "\x1B[%dm",
+ (ansi_color < 0) ?
+ GUI_COLOR_ANSI_DEFAULT_FG :
+ ((ansi_color < 8) ?
+ ansi_color + 30 : ansi_color - 8 + 90));
+ string_dyn_concat (out, str_concat, -1);
}
ptr_string += 2;
}
@@ -1506,14 +1503,13 @@ gui_color_encode_ansi (const char *string)
if (error && !error[0])
{
ansi_color = gui_color_weechat_to_ansi (color);
- if (ansi_color >= 0)
- {
- snprintf (str_concat, sizeof (str_concat),
- "\x1B[%dm",
- (ansi_color < 8) ?
- ansi_color + 40 : ansi_color - 8 + 100);
- string_dyn_concat (out, str_concat, -1);
- }
+ snprintf (str_concat, sizeof (str_concat),
+ "\x1B[%dm",
+ (ansi_color < 0) ?
+ GUI_COLOR_ANSI_DEFAULT_BG :
+ ((ansi_color < 8) ?
+ ansi_color + 40 : ansi_color - 8 + 100));
+ string_dyn_concat (out, str_concat, -1);
}
ptr_string += 2;
}