mirror of
https://github.com/irssi/irssi.git
synced 2026-08-15 14:42:08 +02:00
Highlight colors can now have background color set with fg,bg. Works
with activity list too, useful for example blinking. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1249 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
1117638b52
commit
c1c7674ae2
7 changed files with 58 additions and 20 deletions
|
|
@ -291,11 +291,32 @@ HILIGHT_REC *hilight_match(SERVER_REC *server, const char *channel,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static int get_colors(const char *color, int *fg, int *bg)
|
||||
{
|
||||
const char *p;
|
||||
|
||||
if (!is_numeric(color, ','))
|
||||
return FALSE;
|
||||
|
||||
*fg = atoi(color);
|
||||
*bg = -1;
|
||||
|
||||
p = strchr(color, ',');
|
||||
if (p != NULL) {
|
||||
p++;
|
||||
if (!is_numeric(p, '\0'))
|
||||
return FALSE;
|
||||
*bg = atoi(p);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
char *hilight_get_color(HILIGHT_REC *rec, int activity)
|
||||
{
|
||||
const char *color;
|
||||
char number[MAX_INT_STRLEN];
|
||||
int colornum;
|
||||
int colornum, fg, bg;
|
||||
|
||||
g_return_val_if_fail(rec != NULL, NULL);
|
||||
|
||||
|
|
@ -315,15 +336,16 @@ char *hilight_get_color(HILIGHT_REC *rec, int activity)
|
|||
color = number;
|
||||
}
|
||||
|
||||
if (is_numeric(color, 0))
|
||||
return g_strdup_printf("\003%02d", atoi(color));
|
||||
|
||||
if (get_colors(color, &fg, &bg)) {
|
||||
return bg == -1 ? g_strdup_printf("\003%02d", fg) :
|
||||
g_strdup_printf("\003%d,%02d", fg, bg);
|
||||
}
|
||||
return g_strdup(color);
|
||||
}
|
||||
|
||||
static void hilight_update_text_dest(TEXT_DEST_REC *dest, HILIGHT_REC *rec)
|
||||
{
|
||||
char *color;
|
||||
char *color, *bgcolor;
|
||||
|
||||
dest->level |= MSGLEVEL_HILIGHT;
|
||||
|
||||
|
|
@ -331,8 +353,14 @@ static void hilight_update_text_dest(TEXT_DEST_REC *dest, HILIGHT_REC *rec)
|
|||
dest->hilight_priority = rec->priority;
|
||||
|
||||
color = hilight_get_color(rec, TRUE);
|
||||
if (*color == 3)
|
||||
if (*color == 3) {
|
||||
dest->hilight_color = atoi(color+1);
|
||||
bgcolor = color+1;
|
||||
while (*bgcolor != ',' && *bgcolor != '\0')
|
||||
bgcolor++;
|
||||
dest->hilight_bg_color = *bgcolor != ',' ? -1 :
|
||||
atoi(bgcolor+1);
|
||||
}
|
||||
g_free(color);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue