version 1.164, 2014/01/28 23:07:09 |
version 1.165, 2014/02/14 14:37:08 |
|
|
{ |
{ |
char s[32]; |
char s[32]; |
|
|
if (!(tty->term->flags & TERM_256COLOURS) && |
/* |
!(tty->term_flags & TERM_256COLOURS)) |
* If the terminfo entry has 256 colours, assume that setaf and setab |
return (-1); |
* work correctly. |
|
*/ |
|
if (tty->term->flags & TERM_256COLOURS) { |
|
if (*type == '3') |
|
tty_putcode1(tty, TTYC_SETAF, colour); |
|
else |
|
tty_putcode1(tty, TTYC_SETAB, colour); |
|
return (0); |
|
} |
|
|
xsnprintf(s, sizeof s, "\033[%s;5;%hhum", type, colour); |
/* |
tty_puts(tty, s); |
* If the user has specified -2 to the client, setaf and setab may not |
return (0); |
* work, so send the usual sequence. |
|
*/ |
|
if (tty->term_flags & TERM_256COLOURS) { |
|
xsnprintf(s, sizeof s, "\033[%s;5;%hhum", type, colour); |
|
tty_puts(tty, s); |
|
return (0); |
|
} |
|
|
|
return (-1); |
} |
} |
|
|
void |
void |