diff --git a/src/util.cxx b/src/util.cxx index 5e7cb57..00bc488 100644 --- a/src/util.cxx +++ b/src/util.cxx @@ -141,15 +141,14 @@ char const* ansi_color( Replxx::Color color_ ) { } else if ( fg <= static_cast( Replxx::Color::LIGHTGRAY ) ) { pos = snprintf( colorBuffer, MAX_COLOR_CODE_SIZE, "\033[0;22;3%d%s%sm", fg, underline, bold ); } else if ( fg <= static_cast( Replxx::Color::WHITE ) ) { -#ifdef _WIN32 - static bool const has256colorDefault( true ); -#else - static bool const has256colorDefault( false ); -#endif - static char const* TERM( getenv( "TERM" ) ); - static bool const has256color( TERM ? ( strstr( TERM, "256" ) != nullptr ) : has256colorDefault ); - static char const* ansiEscapeCodeTemplate = has256color ? "\033[0;9%d%s%sm" : "\033[0;1;3%d%s%sm"; - pos = snprintf( colorBuffer, MAX_COLOR_CODE_SIZE, ansiEscapeCodeTemplate, fg - static_cast( Replxx::Color::GRAY ), underline, bold ); + /* Aixterm bright color codes (90-97) belong to the basic 16-color set and are supported + * by virtually every terminal in use. Previously they were emitted only when TERM + * contained "256" (they are unrelated to 256-color support), with a fallback to + * bold + dark color otherwise. That broke bright colors on terminals with TERM values + * like xterm-ghostty, xterm-kitty, alacritty or foot: modern terminals do not render + * bold as bright by default, so e.g. GRAY (bold black) degraded to plain black, + * invisible on a dark background. */ + pos = snprintf( colorBuffer, MAX_COLOR_CODE_SIZE, "\033[0;9%d%s%sm", fg - static_cast( Replxx::Color::GRAY ), underline, bold ); } else { pos = snprintf( colorBuffer, MAX_COLOR_CODE_SIZE, "\033[0;38;5;%d%s%sm", fg, underline, bold ); } diff --git a/tests.py b/tests.py index 9fb83e1..1cd7d82 100755 --- a/tests.py +++ b/tests.py @@ -148,20 +148,20 @@ "\x1b[0;22;35m": "", "\x1b[0;22;36m": "", "\x1b[0;22;37m": "", - "\x1b[0;1;30m": "", - "\x1b[0;1;31m": "", - "\x1b[0;1;32m": "", - "\x1b[0;1;33m": "", - "\x1b[0;1;34m": "", - "\x1b[0;1;35m": "", - "\x1b[0;1;36m": "", - "\x1b[0;1;37m": "", + "\x1b[0;90m": "", + "\x1b[0;91m": "", + "\x1b[0;92m": "", + "\x1b[0;93m": "", + "\x1b[0;94m": "", + "\x1b[0;95m": "", + "\x1b[0;96m": "", + "\x1b[0;97m": "", "\x1b[0;1m": "", "\x1b[0;4m": "", "\x1b[0;4;1m": "", "\x1b[0;22;31;1m": "", "\x1b[0;22;31;4m": "", - "\x1b[0;1;31;1m": "", + "\x1b[0;91;1m": "", "\x1b[0;22;31;4;1m": "", "\x1b[40m": "", "\x1b[41m": "",