Smart color handling:

* if on Windows, no color, as usual
* if on Linux, color only on real term
  * no color when > foo
  * no color in the logfile
This commit is contained in:
Philippe Teuwen 2019-04-30 00:41:52 +02:00
commit a91d0a7b19
10 changed files with 101 additions and 112 deletions

View file

@ -19,6 +19,7 @@
#include <stdio.h>
#include <time.h>
#include "ui.h" // PrintAndLog
#include "commonutil.h"
#ifdef ANDROID
#include <endian.h>
@ -112,42 +113,6 @@
# define FILE_PATH_SIZE 1000
#endif
#if defined(__linux__) || (__APPLE__)
# define _BLUE_(s) "\x1b[34m" s "\x1b[0m "
#else
# define _BLUE_(s) s " "
#endif
#if defined(__linux__) || (__APPLE__)
# define _RED_(s) "\x1b[31m" s "\x1b[0m "
#else
# define _RED_(s) s " "
#endif
#if defined(__linux__) || (__APPLE__)
# define _GREEN_(s) "\x1b[32m" s "\x1b[0m "
#else
# define _GREEN_(s) s " "
#endif
#if defined(__linux__) || (__APPLE__)
# define _YELLOW_(s) "\x1b[33m" s "\x1b[0m "
#else
# define _YELLOW_(s) s " "
#endif
#if defined(__linux__) || (__APPLE__)
# define _MAGENTA_(s) "\x1b[35m" s "\x1b[0m "
#else
# define _MAGENTA_(s) s " "
#endif
#if defined(__linux__) || (__APPLE__)
# define _CYAN_(s) "\x1b[36m" s "\x1b[0m "
#else
# define _CYAN_(s) s " "
#endif
#ifndef DropField
#define DropField() { \
clearCommandBuffer(); SendCommandOLD(CMD_READER_ISO_14443a, 0, 0, 0, NULL, 0); \