This commit is contained in:
Přemysl Eric Janouch 2018-06-24 02:45:41 +02:00
parent b990e7b6a2
commit ea07d8931c
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 25 additions and 25 deletions

View File

@ -604,34 +604,34 @@ end:
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
static const char *g_ansi_table[2 * PALETTE_WIDTH] =
{
"\033[0m",
"\033[0;40m",
"\033[0;41m",
"\033[0;42m",
"\033[0;43m",
"\033[0;44m",
"\033[0;45m",
"\033[0;46m",
"\033[0;47m",
"\033[0;1;7m",
"\033[0;1;7;30m",
"\033[0;1;7;31m",
"\033[0;1;7;32m",
"\033[0;1;7;33m",
"\033[0;1;7;34m",
"\033[0;1;7;35m",
"\033[0;1;7;36m",
"\033[0;1;7;37m",
};
static const char * static const char *
color_to_ansi (uint8_t color) color_to_ansi (uint8_t color)
{ {
static const char *table[2 * PALETTE_WIDTH] = if (color < N_ELEMENTS (g_ansi_table))
{ return g_ansi_table[color];
"\033[0m", return NULL;
"\033[0;40m",
"\033[0;41m",
"\033[0;42m",
"\033[0;43m",
"\033[0;44m",
"\033[0;45m",
"\033[0;46m",
"\033[0;47m",
"\033[0;1;7m",
"\033[0;1;7;30m",
"\033[0;1;7;31m",
"\033[0;1;7;32m",
"\033[0;1;7;33m",
"\033[0;1;7;34m",
"\033[0;1;7;35m",
"\033[0;1;7;36m",
"\033[0;1;7;37m",
};
if (color >= sizeof table / sizeof table[0])
return NULL;
return table[color];
} }
static void static void