diff --git a/colour.c b/colour.c index 3166b137..eef31a30 100644 --- a/colour.c +++ b/colour.c @@ -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); } diff --git a/input.c b/input.c index 5e3d5834..0e342338 100644 --- a/input.c +++ b/input.c @@ -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; } } diff --git a/tmux.1 b/tmux.1 index 6ab6366e..5cee0f72 100644 --- a/tmux.1 +++ b/tmux.1 @@ -1980,6 +1980,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 diff --git a/tty.c b/tty.c index a4e7d7b1..d248a889 100644 --- a/tty.c +++ b/tty.c @@ -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 */ }