mirror of
https://github.com/radareorg/radare2.git
synced 2025-02-25 16:51:30 +00:00
Renamed COLOR_MODE constants
This commit is contained in:
parent
acea95544d
commit
b2b647a5f7
@ -524,7 +524,7 @@ int main(int argc, char **argv, char **envp) {
|
||||
/* implicit -q */
|
||||
r_config_set (r.config, "scr.interactive", "false");
|
||||
r_config_set (r.config, "scr.prompt", "false");
|
||||
r_config_set_i (r.config, "scr.color", COLORS_DISABLED);
|
||||
r_config_set_i (r.config, "scr.color", COLOR_MODE_DISABLED);
|
||||
quiet = true;
|
||||
break;
|
||||
case 'u':
|
||||
@ -1292,7 +1292,7 @@ int main(int argc, char **argv, char **envp) {
|
||||
#if UNCOLORIZE_NONTTY
|
||||
#if __UNIX__
|
||||
if (!r_cons_isatty ()) {
|
||||
r_config_set_i (r.config, "scr.color", COLORS_DISABLED);
|
||||
r_config_set_i (r.config, "scr.color", COLOR_MODE_DISABLED);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
@ -816,8 +816,8 @@ int main(int argc, char **argv) {
|
||||
addr = "main";
|
||||
}
|
||||
/* should be in mode not in bool pdc */
|
||||
r_config_set (c->config, "scr.color", COLORS_DISABLED);
|
||||
r_config_set (c2->config, "scr.color", COLORS_DISABLED);
|
||||
r_config_set (c->config, "scr.color", COLOR_MODE_DISABLED);
|
||||
r_config_set (c2->config, "scr.color", COLOR_MODE_DISABLED);
|
||||
|
||||
ut64 addra = r_num_math (c->num, addr);
|
||||
bufa = (ut8 *) r_core_cmd_strf (c, "af;pdc @ 0x%08"PFMT64x, addra);
|
||||
|
@ -73,7 +73,7 @@ static inline void r_cons_write(const char *buf, int len) {
|
||||
|
||||
R_API RColor r_cons_color_random(ut8 alpha) {
|
||||
RColor rcolor;
|
||||
if (I.color > COLORS_16) {
|
||||
if (I.color > COLOR_MODE_16) {
|
||||
rcolor.r = r_num_rand (0xff);
|
||||
rcolor.g = r_num_rand (0xff);
|
||||
rcolor.b = r_num_rand (0xff);
|
||||
@ -277,7 +277,7 @@ R_API RCons *r_cons_new() {
|
||||
I.event_interrupt = NULL;
|
||||
I.is_wine = -1;
|
||||
I.fps = 0;
|
||||
I.color = COLORS_DISABLED;
|
||||
I.color = COLOR_MODE_DISABLED;
|
||||
I.blankline = true;
|
||||
I.teefile = NULL;
|
||||
I.fix_columns = 0;
|
||||
|
@ -372,11 +372,11 @@ R_API void r_cons_pal_show () {
|
||||
colors[i].name);
|
||||
}
|
||||
switch (r_cons_singleton ()->color) {
|
||||
case COLORS_256: // 256 color palette
|
||||
case COLOR_MODE_256: // 256 color palette
|
||||
r_cons_pal_show_gs ();
|
||||
r_cons_pal_show_256 ();
|
||||
break;
|
||||
case COLORS_16M: // 16M (truecolor)
|
||||
case COLOR_MODE_16M: // 16M (truecolor)
|
||||
r_cons_pal_show_gs ();
|
||||
r_cons_pal_show_rgb ();
|
||||
break;
|
||||
|
@ -178,13 +178,13 @@ R_API char *r_cons_rgb_str(char *outstr, ut8 r, ut8 g, ut8 b, ut8 a) {
|
||||
return outstr;
|
||||
}
|
||||
switch (r_cons_singleton ()->color) {
|
||||
case COLORS_256: // 256 color palette
|
||||
case COLOR_MODE_256: // 256 color palette
|
||||
sprintf (outstr, "\x1b[%d;5;%dm", fgbg, rgb (r, g, b));
|
||||
break;
|
||||
case COLORS_16M: // 16M (truecolor)
|
||||
case COLOR_MODE_16M: // 16M (truecolor)
|
||||
sprintf (outstr, "\x1b[%d;2;%d;%d;%dm", fgbg, r, g, b);
|
||||
break;
|
||||
case COLORS_16: // ansi 16 colors
|
||||
case COLOR_MODE_16: // ansi 16 colors
|
||||
{
|
||||
const char *bold = (a == ALPHA_BOLD)? "1;": "";
|
||||
int k = (r + g + b) / 3;
|
||||
|
@ -958,7 +958,7 @@ static char *core_anal_graph_label(RCore *core, RAnalBlock *bb, int opts) {
|
||||
const bool scrColor = r_config_get (core->config, "scr.color");
|
||||
const bool scrUtf8 = r_config_get (core->config, "scr.utf8");
|
||||
const bool asmComments = r_config_get (core->config, "asm.comments");
|
||||
r_config_set (core->config, "scr.color", COLORS_DISABLED);
|
||||
r_config_set (core->config, "scr.color", COLOR_MODE_DISABLED);
|
||||
r_config_set (core->config, "scr.utf8", "false");
|
||||
r_config_set (core->config, "asm.comments", "false");
|
||||
snprintf (cmd, sizeof (cmd),
|
||||
|
@ -1012,7 +1012,7 @@ static int cb_color(void *user, void *data) {
|
||||
} else {
|
||||
core->print->flags &= (~R_PRINT_FLAGS_COLOR);
|
||||
}
|
||||
r_cons_singleton ()->color = (node->i_value > COLORS_16M)? COLORS_16M: node->i_value;
|
||||
r_cons_singleton ()->color = (node->i_value > COLOR_MODE_16M)? COLOR_MODE_16M: node->i_value;
|
||||
r_cons_pal_update_event ();
|
||||
r_print_set_flags (core->print, core->print->flags);
|
||||
return true;
|
||||
@ -2799,7 +2799,7 @@ R_API int r_core_config_init(RCore *core) {
|
||||
SETCB ("scr.prompt", "true", &cb_scrprompt, "Show user prompt (used by r2 -q)");
|
||||
SETCB ("scr.tee", "", &cb_teefile, "Pipe output to file of this name");
|
||||
SETPREF ("scr.seek", "", "Seek to the specified address on startup");
|
||||
SETICB ("scr.color", (core->print->flags&R_PRINT_FLAGS_COLOR)?COLORS_16:COLORS_DISABLED, &cb_color, "Enable colors (0: none, 1: ansi, 2: 256 colors, 3: truecolor)");
|
||||
SETICB ("scr.color", (core->print->flags&R_PRINT_FLAGS_COLOR)?COLOR_MODE_16:COLOR_MODE_DISABLED, &cb_color, "Enable colors (0: none, 1: ansi, 2: 256 colors, 3: truecolor)");
|
||||
SETCB ("scr.null", "false", &cb_scrnull, "Show no output");
|
||||
SETCB ("scr.utf8", r_cons_is_utf8()?"true":"false",
|
||||
&cb_utf8, "Show UTF-8 characters instead of ANSI");
|
||||
|
@ -1439,7 +1439,7 @@ R_API int r_core_cmd_pipe(RCore *core, char *radare_cmd, char *shell_cmd) {
|
||||
r_config_set_i (core->config, "scr.interactive", 0);
|
||||
if (!r_config_get_i (core->config, "scr.pipecolor")) {
|
||||
pipecolor = r_config_get_i (core->config, "scr.color");
|
||||
r_config_set_i (core->config, "scr.color", COLORS_DISABLED);
|
||||
r_config_set_i (core->config, "scr.color", COLOR_MODE_DISABLED);
|
||||
}
|
||||
if (*shell_cmd=='!') {
|
||||
r_cons_grep_parsecmd (shell_cmd, "\"");
|
||||
@ -1884,7 +1884,7 @@ static int r_core_cmd_subst_i(RCore *core, char *cmd, char *colon) {
|
||||
r_config_set_i (core->config, "scr.html", true);
|
||||
} else if (!strcmp (ptr + 1, "T")) { // "|T"
|
||||
scr_color = r_config_get_i (core->config, "scr.color");
|
||||
r_config_set_i (core->config, "scr.color", COLORS_DISABLED);
|
||||
r_config_set_i (core->config, "scr.color", COLOR_MODE_DISABLED);
|
||||
core->cons->use_tts = true;
|
||||
} else if (ptr[1]) { // "| grep .."
|
||||
int value = core->num->value;
|
||||
@ -1904,7 +1904,7 @@ static int r_core_cmd_subst_i(RCore *core, char *cmd, char *colon) {
|
||||
scr_html = r_config_get_i (core->config, "scr.html");
|
||||
r_config_set_i (core->config, "scr.html", 0);
|
||||
scr_color = r_config_get_i (core->config, "scr.color");
|
||||
r_config_set_i (core->config, "scr.color", COLORS_DISABLED);
|
||||
r_config_set_i (core->config, "scr.color", COLOR_MODE_DISABLED);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2063,7 +2063,7 @@ next:
|
||||
pipefd = r_cons_pipe_open (str, fdn, ptr[1] == '>');
|
||||
if (pipefd != -1) {
|
||||
if (!pipecolor) {
|
||||
r_config_set_i (core->config, "scr.color", COLORS_DISABLED);
|
||||
r_config_set_i (core->config, "scr.color", COLOR_MODE_DISABLED);
|
||||
}
|
||||
ret = r_core_cmd_subst (core, cmd);
|
||||
r_cons_flush ();
|
||||
|
@ -1967,7 +1967,7 @@ static void disasm_strings(RCore *core, const char *input, RAnalFunction *fcn) {
|
||||
RConsPrintablePalette *pal = &core->cons->pal;
|
||||
// force defaults
|
||||
r_config_set_i (core->config, "asm.offset", true);
|
||||
r_config_set_i (core->config, "scr.color", COLORS_DISABLED);
|
||||
r_config_set_i (core->config, "scr.color", COLOR_MODE_DISABLED);
|
||||
r_config_set_i (core->config, "asm.tabs", 0);
|
||||
r_config_set_i (core->config, "asm.cmt.right", true);
|
||||
r_cons_push();
|
||||
|
@ -3150,7 +3150,7 @@ R_API void r_core_visual_colors(RCore *core) {
|
||||
}
|
||||
r_cons_gotoxy (0, 0);
|
||||
r_cons_rgb_str (cstr, rcolor.r, rcolor.g, rcolor.b, ALPHA_NORMAL);
|
||||
if (r_cons_singleton ()->color < COLORS_16M) {
|
||||
if (r_cons_singleton ()->color < COLOR_MODE_16M) {
|
||||
rcolor.r &= 0xf;
|
||||
rcolor.g &= 0xf;
|
||||
rcolor.b &= 0xf;
|
||||
|
@ -140,7 +140,7 @@ enum {
|
||||
};
|
||||
#endif
|
||||
|
||||
enum { COLORS_DISABLED = 0, COLORS_16, COLORS_256, COLORS_16M };
|
||||
enum { COLOR_MODE_DISABLED = 0, COLOR_MODE_16, COLOR_MODE_256, COLOR_MODE_16M };
|
||||
|
||||
enum { ALPHA_RESET = 0x00, ALPHA_NORMAL = 0x01, ALPHA_BG = 0x02, ALPHA_BOLD = 0x03 };
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user