---
I'd like to add later support for more tints so we can different highligh.
libavutil/log.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/libavutil/log.c b/libavutil/log.c
index bd46b0c..30a1626 100644
--- a/libavutil/log.c
+++ b/libavutil/log.c
@@ -53,6 +53,9 @@ static HANDLE con;
#else
static const uint8_t color[] = { 0x41, 0x41, 0x11, 0x03, 9, 0x02, 0x06 };
#define set_color(x) fprintf(stderr, "\033[%d;3%dm", color[x] >> 4,
color[x]&15)
+static const uint8_t color256[] = { 124, 196, 160, 105, 231, 148, 38 };
+#define set_256color(x) \
+ fprintf(stderr, "\033[38;5;%dm", color256[x])
#define reset_color() fprintf(stderr, "\033[0m")
#endif
static int use_color = -1;
@@ -78,10 +81,19 @@ static void colored_fputs(int level, const char *str)
use_color = getenv("AV_LOG_FORCE_COLOR") && !getenv("NO_COLOR") &&
!getenv("AV_LOG_FORCE_NOCOLOR");
#endif
+ //FIXME Check properly for 256 colors terminal
+ use_color += !!getenv("COLORTERM");
}
- if (use_color) {
+ switch (use_color) {
+ case 1:
set_color(level);
+ break;
+ case 2:
+ set_256color(level);
+ break;
+ default:
+ break;
}
fputs(str, stderr);
if (use_color) {
--
1.8.1.5
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel