summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-03-25 20:38:40 +0100
committerwm4 <wm4@nowhere>2013-03-26 01:17:38 +0100
commit1d530f0e310f6569f6ca4a4af98e3919bc832479 (patch)
tree2ec968e635e0a4c81b02d5ba78db52b7b92b4318 /core
parent840c98d190d1b79573987a137ae3372574efcb63 (diff)
downloadmpv-1d530f0e310f6569f6ca4a4af98e3919bc832479.tar.bz2
mpv-1d530f0e310f6569f6ca4a4af98e3919bc832479.tar.xz
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.
Diffstat (limited to 'core')
-rw-r--r--core/mp_msg.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/core/mp_msg.c b/core/mp_msg.c
index e06d53c0d9..0661416c55 100644
--- a/core/mp_msg.c
+++ b/core/mp_msg.c
@@ -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
}
}