From 2d4edc51877719c49d712271967313310f4796fb Mon Sep 17 00:00:00 2001 From: Tom Feist Date: Tue, 3 May 2011 15:40:34 +0100 Subject: Initial implementation of 256 colour support for Irssi This patch implements some 256 colour support for Irssi up from the previous 16 colours. Initial parsing of the %x/%X format codes is implemented and the parser accounts in advances the char* for that. The colour attributes are widened from 4 to 8 bit. The colour protocol is changed to a new format. Some pointers to remaining work are written in the comment in textbuffer.h. Note that Irssi already does support requesting 256 colours from the terminal in the original source code, so this part did not have to be touched. --- src/fe-text/term.h | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'src/fe-text/term.h') diff --git a/src/fe-text/term.h b/src/fe-text/term.h index 27174c83..5a40d4b2 100644 --- a/src/fe-text/term.h +++ b/src/fe-text/term.h @@ -4,12 +4,29 @@ typedef struct _TERM_WINDOW TERM_WINDOW; /* text attributes */ -#define ATTR_RESETFG 0x0100 -#define ATTR_RESETBG 0x0200 -#define ATTR_BOLD 0x0400 -#define ATTR_BLINK 0x0800 -#define ATTR_UNDERLINE 0x1000 -#define ATTR_REVERSE 0x2000 + + +#define FG_MASK ( 0x00ff ) +#define BG_MASK ( 0xff00 ) + +#define ATTR_RESETFG ( 0x010000 ) +#define ATTR_RESETBG ( 0x020000 ) +#define ATTR_BOLD ( 0x040000 ) +#define ATTR_BLINK ( 0x080000 ) +#define ATTR_UNDERLINE ( 0x100000 ) +#define ATTR_REVERSE ( 0x200000 ) + +/* can also mean default color, probably. */ +#define ATTR_COLOR_UNDEFINED ( -1 ) + +#define EXT_COLOR_BLACK ( 0 ) +#define EXT_COLOR_RED ( 1 ) +#define EXT_COLOR_GREEN ( 2 ) +#define EXT_COLOR_YELLOW ( 3 ) +#define EXT_COLOR_BLUE ( 4 ) +#define EXT_COLOR_MAGENTA ( 5 ) +#define EXT_COLOR_CYAN ( 6 ) +#define EXT_COLOR_WHITE ( 7 ) #define ATTR_RESET (ATTR_RESETFG|ATTR_RESETBG) @@ -65,6 +82,8 @@ void term_window_scroll(TERM_WINDOW *window, int count); void term_set_color(TERM_WINDOW *window, int col); +void term_set_extended_color(TERM_WINDOW *window, int fg, int bg); + void term_move(TERM_WINDOW *window, int x, int y); void term_addch(TERM_WINDOW *window, char chr); void term_add_unichar(TERM_WINDOW *window, unichar chr); -- cgit v1.2.3