Render ANSI black text inverse (so that it is readable on black terminals)

This commit is contained in:
Tim Angus 2025-10-04 21:02:03 +01:00
parent 12ae6973a6
commit 852adafe57

View File

@ -377,7 +377,7 @@ void Sys_AnsiColorPrint( const char *msg )
int length = 0;
static int q3ToAnsi[ 8 ] =
{
30, // COLOR_BLACK
7, // COLOR_BLACK
31, // COLOR_RED
32, // COLOR_GREEN
33, // COLOR_YELLOW
@ -407,8 +407,8 @@ void Sys_AnsiColorPrint( const char *msg )
}
else
{
// Print the color code
Com_sprintf( buffer, sizeof( buffer ), "\033[%dm",
// Print the color code (reset first to clear potential inverse (black))
Com_sprintf( buffer, sizeof( buffer ), "\033[0m\033[%dm",
q3ToAnsi[ ColorIndex( *( msg + 1 ) ) ] );
fputs( buffer, stderr );
msg += 2;