mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-24 17:41:16 -03:00
Use the nonbright variant of brights on lame terms
With this change, 'set_color brred; echo bright red' will at leaat be red on Linux/FreeBSD virt consoles.
This commit is contained in:
@@ -71,6 +71,14 @@ static bool write_color_escape(char *todo, unsigned char idx, bool is_fg) {
|
||||
// We are attempting to bypass the term here. Generate the ANSI escape sequence ourself.
|
||||
char buff[16] = "";
|
||||
if (idx < 16) {
|
||||
// this allows the non-bright color to happen instead of no color working at all when
|
||||
// a bright is attempted when only colors 0-7 are supported.
|
||||
// TODO: enter bold mode in builtin_set_color in the same circumstance- doing that
|
||||
// combined
|
||||
// with what we do here, will make the brights actually work for virtual
|
||||
// consoles/ancient emulators.
|
||||
if (max_colors == 8 && idx > 8) idx -= 8;
|
||||
|
||||
snprintf(buff, sizeof buff, "\x1b[%dm", ((idx > 7) ? 82 : 30) + idx + !is_fg * 10);
|
||||
} else {
|
||||
snprintf(buff, sizeof buff, "\x1b[%d;5;%dm", is_fg ? 38 : 48, idx);
|
||||
|
||||
Reference in New Issue
Block a user