mp_msg: don't change text color for normal output

Normal text was set to gray foreground color. This didn't work for
terminals with white background.

Instead of setting a color for normal text, reset the color attributes.
This way, only errors and warnings are formatted differently.

Also change the default color for MSGL_HINT from bold white to yellow.
This commit is contained in:
wm4 2013-03-25 20:38:40 +01:00
parent 840c98d190
commit 1d530f0e31
1 changed files with 8 additions and 2 deletions

View File

@ -121,7 +121,7 @@ int mp_msg_test(int mod, int lev)
static void set_msg_color(FILE* stream, int lev)
{
static const unsigned char v_colors[10] = {9, 1, 3, 15, 7, 7, 2, 8, 8, 8};
static const int v_colors[10] = {9, 1, 3, 3, -1, -1, 2, 8, 8, 8};
int c = v_colors[lev];
#ifdef MP_ANNOY_ME
/* that's only a silly color test */
@ -138,9 +138,15 @@ static void set_msg_color(FILE* stream, int lev)
{
#ifdef _WIN32
HANDLE *wstream = stream == stderr ? hSTDERR : hSTDOUT;
if (c == -1)
c = 7;
SetConsoleTextAttribute(wstream, ansi2win32[c] | FOREGROUND_INTENSITY);
#else
fprintf(stream, "\033[%d;3%dm", c >> 3, c & 7);
if (c == -1) {
fprintf(stream, "\033[0m");
} else {
fprintf(stream, "\033[%d;3%dm", c >> 3, c & 7);
}
#endif
}
}