1 //-----------------------------------------------------------------------------
2 // Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // See LICENSE.txt for the text of the license.
15 //-----------------------------------------------------------------------------
19 // Not ANSI but dirty trick to specify we don't want a \n
22 #define AEND "\x1b[0m"
24 #define _BLACK_(s) "\x1b[30m" s AEND
25 #define _RED_(s) "\x1b[31m" s AEND
26 #define _GREEN_(s) "\x1b[32m" s AEND
27 #define _YELLOW_(s) "\x1b[33m" s AEND
28 #define _BLUE_(s) "\x1b[34m" s AEND
29 #define _MAGENTA_(s) "\x1b[35m" s AEND
30 #define _CYAN_(s) "\x1b[36m" s AEND
31 #define _WHITE_(s) "\x1b[37m" s AEND
33 #define _BRIGHT_BLACK_(s) "\x1b[30;1m" s AEND
34 #define _BRIGHT_RED_(s) "\x1b[31;1m" s AEND
35 #define _BRIGHT_GREEN_(s) "\x1b[32;1m" s AEND
36 #define _BRIGHT_YELLOW_(s) "\x1b[33;1m" s AEND
37 #define _BRIGHT_BLUE_(s) "\x1b[34;1m" s AEND
38 #define _BRIGHT_MAGENTA_(s) "\x1b[35;1m" s AEND
39 #define _BRIGHT_CYAN_(s) "\x1b[36;1m" s AEND
40 #define _BRIGHT_WHITE_(s) "\x1b[37;1m" s AEND
42 #define _BACK_BLACK_(s) "\x1b[40m" s AEND
43 #define _BACK_RED_(s) "\x1b[41m" s AEND
44 #define _BACK_GREEN_(s) "\x1b[42m" s AEND
45 #define _BACK_YELLOW_(s) "\x1b[43m" s AEND
46 #define _BACK_BLUE_(s) "\x1b[44m" s AEND
47 #define _BACK_MAGENTA_(s) "\x1b[45m" s AEND
48 #define _BACK_CYAN_(s) "\x1b[46m" s AEND
49 #define _BACK_WHITE_(s) "\x1b[47m" s AEND
51 #define _BACK_BRIGHT_BLACK_(s) "\x1b[40;1m" s AEND
52 #define _BACK_BRIGHT_RED_(s) "\x1b[41;1m" s AEND
53 #define _BACK_BRIGHT_GREEN_(s) "\x1b[42;1m" s AEND
54 #define _BACK_BRIGHT_YELLOW_(s) "\x1b[43;1m" s AEND
55 #define _BACK_BRIGHT_BLUE_(s) "\x1b[44;1m" s AEND
56 #define _BACK_BRIGHT_MAGENTA_(s) "\x1b[45;1m" s AEND
57 #define _BACK_BRIGHT_CYAN_(s) "\x1b[46;1m" s AEND
58 #define _BACK_BRIGHT_WHITE_(s) "\x1b[47;1m" s AEND
60 #define _CLEAR_ "\x1b[2J"
61 #define _CLEAR_SCROLLBACK_ "\x1b[3J"
62 #define _TOP_ "\x1b[1;1f"
64 #if defined(HAVE_READLINE)
65 // https://wiki.hackzine.org/development/misc/readline-color-prompt.html
66 // Applications may indicate that the prompt contains
67 // characters that take up no physical screen space when displayed by
68 // bracketing a sequence of such characters with the special markers
69 // RL_PROMPT_START_IGNORE = '\001' and RL_PROMPT_END_IGNORE = '\002'
70 #define RL_ESC(a) "\001" a "\002"
73 #endif // HAVE_READLINE
75 #define _RL_RED_(s) RL_ESC("\x1b[31m") s RL_ESC(AEND)
76 #define _RL_GREEN_(s) RL_ESC("\x1b[32m") s RL_ESC(AEND)
77 #define _RL_BOLD_RED_(s) RL_ESC("\x1b[1;31m") s RL_ESC(AEND)
78 #define _RL_BOLD_GREEN_(s) RL_ESC("\x1b[1;32m") s RL_ESC(AEND)