diff options
author | B. Watson <urchlay@slackware.uk> | 2024-12-21 04:29:14 -0500 |
---|---|---|
committer | B. Watson <urchlay@slackware.uk> | 2024-12-21 04:29:14 -0500 |
commit | d7546f793ca01866ba1a1351e2f139a7c0ed9711 (patch) | |
tree | 796dfe98845ed3146350465ff0e71d49682a3bfb /uxd.c | |
parent | b51d501fd23f18f3d1f6222cbf8fc3f714bc330e (diff) | |
download | uxd-d7546f793ca01866ba1a1351e2f139a7c0ed9711.tar.gz |
alternating colors for specials
Diffstat (limited to 'uxd.c')
-rw-r--r-- | uxd.c | 24 |
1 files changed, 19 insertions, 5 deletions
@@ -101,11 +101,12 @@ FILE *input; /* default colors */ int normal_colors[] = { GREEN, YELLOW }; +int special_colors[] = { PURPLE, CYAN }; int bad_color = RED; -int special_color = PURPLE; -/* toggles between 0 and 1 for each normal character */ +/* toggles between 0 and 1 for each normal/special character */ int cur_normal_hilite = 0; +int cur_special_hilite = 0; /* these buffers are bigger than they need to be really. */ /* offset and hex bytes: */ @@ -219,11 +220,16 @@ void parse_colors(char *arg) { /* optional 3rd color */ if(!arg[2]) return; check_color(arg[2]); - special_color = arg[2] - '0'; + special_colors[0] = arg[2] - '0'; /* optional 4th color */ if(!arg[3]) return; check_color(arg[3]); + special_colors[1] = arg[2] - '0'; + + /* optional 5th color */ + if(!arg[4]) return; + check_color(arg[3]); bad_color = arg[3] - '0'; } @@ -428,6 +434,11 @@ void next_normal_hilite(void) { cur_normal_hilite = !cur_normal_hilite; } +void next_special_hilite(void) { + if(alternate_colors) + cur_special_hilite = !cur_special_hilite; +} + void append_color(char *buf, int hl_type) { char tmpbuf[100]; int fgcolor, bgcolor; @@ -442,12 +453,12 @@ void append_color(char *buf, int hl_type) { bgcolor = normal_colors[cur_normal_hilite]; break; case HL_SPECIAL: - fgcolor = special_color; + fgcolor = special_colors[cur_special_hilite]; bgcolor = 0; break; case HL_SPEC_INV: fgcolor = 0; - bgcolor = special_color; + bgcolor = special_colors[cur_special_hilite]; break; case HL_BAD: default: @@ -764,6 +775,9 @@ int dump_utf8_char(void) { if(hl_type == HL_NORMAL || hl_type == HL_NORM_INV) next_normal_hilite(); + if(hl_type == HL_SPECIAL || hl_type == HL_SPEC_INV) + next_special_hilite(); + return 1; } |