See my patch on http://code.krypto.org/patches/
specifically http://code.krypto.org/patches/ircii-20051015-color-default-01.patch (attached) This patch was made against the debian 20051015 ircII but should be easy to modify and apply against the latest official ircII release (20060725) which still contains the bug. The issue is that ircII always hard sets the fg and bg colors instead of leaving them alone when background_colour and/or foreground_colour are set to a value meaning terminal default (16). This patch also changes the default colors when 'set colour on' is in effect to be the terminal defaults. -greg
diff --unified=6 -r ircii-20051015/include/config.h.dist ircii-20051015-fixed/include/config.h.dist --- ircii-20051015/include/config.h.dist 2006-11-29 23:25:30.000000000 -0800 +++ ircii-20051015-fixed/include/config.h.dist 2006-11-29 22:21:11.588662500 -0800 @@ -110,13 +110,13 @@ * do work without being a pain. */ #define DEFAULT_ALWAYS_SPLIT_BIGGEST 1 #define DEFAULT_AUTO_UNMARK_AWAY 0 #define DEFAULT_AUTO_WHOWAS 0 -#define DEFAULT_BACKGROUND_COLOUR 1 +#define DEFAULT_BACKGROUND_COLOUR 16 #define DEFAULT_BEEP 1 #define DEFAULT_BEEP_MAX 3 #define DEFAULT_BEEP_ON_MSG "NONE" #define DEFAULT_BEEP_WHEN_AWAY 0 #define DEFAULT_BIND_LOCAL_DCCHOST 1 #define DEFAULT_BOLD_VIDEO 1 @@ -140,13 +140,13 @@ #define DEFAULT_DECRYPT_PROGRAM NULL #define DEFAULT_EXEC_PROTECTION 1 #define DEFAULT_FLOOD_AFTER 3 #define DEFAULT_FLOOD_RATE 3 #define DEFAULT_FLOOD_USERS 3 #define DEFAULT_FLOOD_WARNING 0 -#define DEFAULT_FOREGROUND_COLOUR 15 +#define DEFAULT_FOREGROUND_COLOUR 16 #define DEFAULT_FULL_STATUS_LINE 1 #define DEFAULT_HELP_PAGER 1 #define DEFAULT_HELP_PROMPT 1 #define DEFAULT_HELP_WINDOW 0 #define DEFAULT_HIDE_CHANNEL_KEYS 0 #define DEFAULT_HIDE_PRIVATE_CHANNELS 1 diff --unified=6 -r ircii-20051015/include/screen.h ircii-20051015-fixed/include/screen.h --- ircii-20051015/include/screen.h 2005-09-21 13:20:35.000000000 -0700 +++ ircii-20051015-fixed/include/screen.h 2006-11-29 22:25:12.851740500 -0800 @@ -39,12 +39,14 @@ #include "window.h" #define WAIT_PROMPT_LINE 0x01 #define WAIT_PROMPT_KEY 0x02 +#define COLOUR_DEFAULT 16 + /* Stuff for the screen/xterm junk */ #define ST_NOTHING -1 #define ST_SCREEN 0 #define ST_XTERM 1 diff --unified=6 -r ircii-20051015/source/screen.c ircii-20051015-fixed/source/screen.c --- ircii-20051015/source/screen.c 2005-09-22 11:20:03.000000000 -0700 +++ ircii-20051015-fixed/source/screen.c 2006-11-29 23:30:50.193809000 -0800 @@ -468,12 +468,25 @@ */ static void display_colours(fgcolour, bgcolour) int fgcolour; int bgcolour; { + static int current_fg = COLOUR_DEFAULT; + static int current_bg = COLOUR_DEFAULT; + static int current_bold = 0; + static int current_blink = 0; + + int emit_code = 0; + int desired_bold, desired_blink; + + if (fgcolour < 0) + fgcolour = COLOUR_DEFAULT; + if (bgcolour < 0) + bgcolour = COLOUR_DEFAULT; + if (get_int_var(COLOUR_VAR)) { /* Some people will say that I should use termcap values but * since: * 1- iso 6429 is the only used way for colour in the unix * realm for now @@ -483,28 +496,81 @@ * ... I'll stick with this way for now. But having only 8-9 * colour is a pity. * -- Sarayan */ /* Written by Bisqwit ([EMAIL PROTECTED]) */ + /* Reworked to support default terminal color, allowing use of + * color on non-black background terminals. 20061129 + * -- Gregory P. Smith ([EMAIL PROTECTED]) + */ /* mirc colours -> iso 6469 colours translation tables */ static const u_char trans[] = "7042115332664507"; static const u_char bolds[] = "1000100011011110"; /* 0123456789ABCDEF */ u_char iso[15]; /* long enough for "e[0;1;5;37;40m" */ - snprintf(CP(iso), sizeof iso, "\33[0;"); - if (bolds[fgcolour] == '1') - my_strcat(iso, "1;"); - if (bolds[bgcolour] == '1') - my_strcat(iso, "5;"); - snprintf(CP(my_index(iso, 0)), 7, "3%c;4%cm", trans[fgcolour&15], trans[bgcolour&15]); - - fwrite(CP(iso), my_strlen(iso), 1, current_screen->fpout); + snprintf(CP(iso), sizeof iso, "\33["); + if (fgcolour != COLOUR_DEFAULT) + desired_bold = bolds[fgcolour&15] - '0'; + else + desired_bold = current_bold; + + if (bgcolour != COLOUR_DEFAULT) + desired_blink = bolds[bgcolour&15] - '0'; + else + desired_blink = current_blink; + + /* to turn off bold or blink we have to issue a '0' for reset */ + if (current_bold != desired_bold || current_blink != desired_blink) + { + my_strcat(iso, "0"); + emit_code = 1; + current_bold = 0; + current_blink = 0; + current_bg = COLOUR_DEFAULT; /* XXX is this needed? */ + current_fg = COLOUR_DEFAULT; /* XXX is this needed? */ + } + if (desired_bold) + { + if (emit_code) + my_strcat(iso, ";"); + my_strcat(iso, "1"); + emit_code = 1; + current_bold = 1; + } + if (desired_blink) + { + if (emit_code) + my_strcat(iso, ";"); + my_strcat(iso, "5"); + emit_code = 1; + current_blink = 1; + } + + if (fgcolour != current_fg) + { + if (emit_code) + my_strcat(iso, ";"); + snprintf(CP(my_index(iso, 0)), 3, "3%c", trans[fgcolour&15]); + emit_code = 1; + } + if (bgcolour != current_bg) + { + if (emit_code) + my_strcat(iso, ";"); + snprintf(CP(my_index(iso, 0)), 3, "4%c", trans[bgcolour&15]); + emit_code = 1; + } + if (emit_code) + { + my_strcat(iso, "m"); + fwrite(CP(iso), my_strlen(iso), 1, current_screen->fpout); + } } } static void display_text(str, length) u_char *str; @@ -658,21 +724,20 @@ int startpos; { int fgcolour_user = get_int_var(FOREGROUND_COLOUR_VAR), bgcolour_user = get_int_var(BACKGROUND_COLOUR_VAR); static int high = OFF, bold = OFF, - fgcolour = -1, - bgcolour = -1; + fgcolour = COLOUR_DEFAULT, + bgcolour = COLOUR_DEFAULT; int rev_tog, und_tog, bld_tog, all_off; int dobeep = 0; int written = 0; display_highlight(high); display_bold(bold); - display_colours(fgcolour, bgcolour); /* do processing on the string, handle inverse and bells */ display_nonshift(); while (*str) { switch (*str) {