Add strings to allow the aixterm bright colours to be used when

configuring colours, requested by Elliott Cable a few months ago.
pull/1/head
Nicholas Marriott 2012-01-21 08:23:12 +00:00
parent be7b56a613
commit 7f24020cbe
4 changed files with 49 additions and 5 deletions

View File

@ -170,6 +170,22 @@ colour_tostring(int c)
return ("white");
case 8:
return ("default");
case 90:
return ("brightblack");
case 91:
return ("brightred");
case 92:
return ("brightgreen");
case 93:
return ("brightyellow");
case 94:
return ("brightblue");
case 95:
return ("brightmagenta");
case 96:
return ("brightcyan");
case 97:
return ("brightwhite");
}
return (NULL);
}
@ -219,6 +235,30 @@ colour_fromstring(const char *s)
return (7);
if (strcasecmp(s, "default") == 0 || (s[0] == '8' && s[1] == '\0'))
return (8);
if (strcasecmp(s, "brightblack") == 0 ||
(s[0] == '9' && s[1] == '0' && s[1] == '\0'))
return (90);
if (strcasecmp(s, "brightred") == 0 ||
(s[0] == '9' && s[1] == '1' && s[1] == '\0'))
return (91);
if (strcasecmp(s, "brightgreen") == 0 ||
(s[0] == '9' && s[1] == '2' && s[1] == '\0'))
return (92);
if (strcasecmp(s, "brightyellow") == 0 ||
(s[0] == '9' && s[1] == '3' && s[1] == '\0'))
return (93);
if (strcasecmp(s, "brightblue") == 0 ||
(s[0] == '9' && s[1] == '4' && s[1] == '\0'))
return (94);
if (strcasecmp(s, "brightmagenta") == 0 ||
(s[0] == '9' && s[1] == '5' && s[1] == '\0'))
return (95);
if (strcasecmp(s, "brightcyan") == 0 ||
(s[0] == '9' && s[1] == '6' && s[1] == '\0'))
return (96);
if (strcasecmp(s, "brightwhite") == 0 ||
(s[0] == '9' && s[1] == '7' && s[1] == '\0'))
return (97);
return (-1);
}

View File

@ -1436,7 +1436,7 @@ input_csi_dispatch_sgr(struct input_ctx *ictx)
case 106:
case 107:
gc->flags &= ~GRID_FLAG_BG256;
gc->bg = n;
gc->bg = n - 10;
break;
}
}

4
tmux.1
View File

@ -1976,6 +1976,10 @@ is one of:
.Ic magenta ,
.Ic cyan ,
.Ic white ,
aixterm bright variants (if supported:
.Ic brightred ,
.Ic brightgreen ,
and so on),
.Ic colour0
to
.Ic colour255

8
tty.c
View File

@ -1440,7 +1440,7 @@ tty_check_bg(struct tty *tty, struct grid_cell *gc)
/* Is this an aixterm colour? */
colours = tty_term_number(tty->term, TTYC_COLORS);
if (gc->bg >= 100 && gc->bg <= 107 && colours < 16) {
if (gc->bg >= 90 && gc->bg <= 97 && colours < 16) {
gc->bg -= 90;
gc->attr |= GRID_ATTR_BRIGHT;
}
@ -1500,14 +1500,14 @@ tty_colours_bg(struct tty *tty, const struct grid_cell *gc)
}
/* Is this an aixterm bright colour? */
if (bg >= 100 && bg <= 107) {
if (bg >= 90 && bg <= 97) {
/* 16 colour terminals or above only. */
if (tty_term_number(tty->term, TTYC_COLORS) >= 16) {
xsnprintf(s, sizeof s, "\033[%dm", bg);
xsnprintf(s, sizeof s, "\033[%dm", bg + 10);
tty_puts(tty, s);
goto save_bg;
}
bg -= 100;
bg -= 90;
/* no such thing as a bold background */
}