Tweaking the look.
This commit is contained in:
parent
3effb01d8f
commit
e60d7770e0
33
ascii.c
33
ascii.c
@ -85,8 +85,9 @@ static int new_colorpair(int fg, int bg)
|
|||||||
return COLOR_PAIR(next_colornum++);
|
return COLOR_PAIR(next_colornum++);
|
||||||
}
|
}
|
||||||
|
|
||||||
int DECIMAL_COLORS, HEX_COLORS, CHAR_COLORS, DESCRIPTION_COLORS, OUTPUT_CHAR_COLORS,
|
int DECIMAL_COLORS, HEX_COLORS, CHAR_COLORS, DESCRIPTION_SPECIAL_COLORS,
|
||||||
OUTPUT_ESCAPE_COLORS, OUTPUT_LABEL_COLORS, SEARCH_BAR_COLORS, BROWSE_MODE_COLORS,
|
DESCRIPTION_LETTER_COLORS, DESCRIPTION_NUMBER_COLORS, DESCRIPTION_SYMBOL_COLORS,
|
||||||
|
OUTPUT_CHAR_COLORS, OUTPUT_ESCAPE_COLORS, OUTPUT_LABEL_COLORS, BROWSE_MODE_COLORS,
|
||||||
INSERT_MODE_COLORS, SEARCH_MODE_COLORS;
|
INSERT_MODE_COLORS, SEARCH_MODE_COLORS;
|
||||||
|
|
||||||
const int COL_WIDTH = 42;
|
const int COL_WIDTH = 42;
|
||||||
@ -132,13 +133,13 @@ static inline void draw_entry(int i, int scrollx, int attrs)
|
|||||||
printwattrs(CHAR_COLORS | attrs, " %c ", i);
|
printwattrs(CHAR_COLORS | attrs, " %c ", i);
|
||||||
}
|
}
|
||||||
if (NAMES[i][1]) {
|
if (NAMES[i][1]) {
|
||||||
printwattrs(DESCRIPTION_COLORS | A_BOLD | attrs, " %-25s", NAMES[i][1]);
|
printwattrs(DESCRIPTION_SPECIAL_COLORS | attrs, " %-25s", NAMES[i][1]);
|
||||||
} else if (('a' <= i && i <= 'z') || ('A' <= i && i <= 'Z')) {
|
} else if (('a' <= i && i <= 'z') || ('A' <= i && i <= 'Z')) {
|
||||||
printwattrs(DESCRIPTION_COLORS | attrs, " The letter %c ", i);
|
printwattrs(DESCRIPTION_LETTER_COLORS | attrs, " the letter %c ", i);
|
||||||
} else if ('0' <= i && i <= '9') {
|
} else if ('0' <= i && i <= '9') {
|
||||||
printwattrs(DESCRIPTION_COLORS | attrs, " The number %c ", i);
|
printwattrs(DESCRIPTION_NUMBER_COLORS | attrs, " the number %c ", i);
|
||||||
} else {
|
} else {
|
||||||
printwattrs(DESCRIPTION_COLORS | attrs, " The %c character ", i);
|
printwattrs(DESCRIPTION_SYMBOL_COLORS | A_BOLD | attrs, " the %c symbol ", i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,11 +178,11 @@ static int find_ascii_match(int start, int fallback, int direction, char *search
|
|||||||
if (NAMES[c][1]) {
|
if (NAMES[c][1]) {
|
||||||
sprintf(tmp, "%d 0x%02X 0x%02x %s %s", c, c, c, NAMES[c][0] ? NAMES[c][0] : "", NAMES[c][1]);
|
sprintf(tmp, "%d 0x%02X 0x%02x %s %s", c, c, c, NAMES[c][0] ? NAMES[c][0] : "", NAMES[c][1]);
|
||||||
} else if (('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z')) {
|
} else if (('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z')) {
|
||||||
sprintf(tmp, "%d 0x%02X 0x%02x %s The letter %c", c, c, c, NAMES[c][0] ? NAMES[c][0] : "", c);
|
sprintf(tmp, "%d 0x%02X 0x%02x %s the letter %c", c, c, c, NAMES[c][0] ? NAMES[c][0] : "", c);
|
||||||
} else if ('0' <= c && c <= '9') {
|
} else if ('0' <= c && c <= '9') {
|
||||||
sprintf(tmp, "%d 0x%02X 0x%02x %s The number %c", c, c, c, NAMES[c][0] ? NAMES[c][0] : "", c);
|
sprintf(tmp, "%d 0x%02X 0x%02x %s the number %c", c, c, c, NAMES[c][0] ? NAMES[c][0] : "", c);
|
||||||
} else {
|
} else {
|
||||||
sprintf(tmp, "%d 0x%02X 0x%02x %s The %c character", c, c, c, NAMES[c][0] ? NAMES[c][0] : "", c);
|
sprintf(tmp, "%d 0x%02X 0x%02x %s the %c character", c, c, c, NAMES[c][0] ? NAMES[c][0] : "", c);
|
||||||
}
|
}
|
||||||
if (strstr(tmp, searchbuf) != NULL)
|
if (strstr(tmp, searchbuf) != NULL)
|
||||||
return c;
|
return c;
|
||||||
@ -237,14 +238,16 @@ int main(int argc, char *argv[])
|
|||||||
DECIMAL_COLORS = new_colorpair(COLOR_YELLOW, COLOR_BLACK) | A_BOLD;
|
DECIMAL_COLORS = new_colorpair(COLOR_YELLOW, COLOR_BLACK) | A_BOLD;
|
||||||
HEX_COLORS = new_colorpair(COLOR_GREEN, COLOR_BLACK) | A_BOLD;
|
HEX_COLORS = new_colorpair(COLOR_GREEN, COLOR_BLACK) | A_BOLD;
|
||||||
CHAR_COLORS = new_colorpair(COLOR_MAGENTA, COLOR_BLACK) | A_BOLD;
|
CHAR_COLORS = new_colorpair(COLOR_MAGENTA, COLOR_BLACK) | A_BOLD;
|
||||||
DESCRIPTION_COLORS = new_colorpair(COLOR_WHITE, COLOR_BLACK);
|
DESCRIPTION_SPECIAL_COLORS = new_colorpair(COLOR_RED, COLOR_BLACK) | A_BOLD;
|
||||||
|
DESCRIPTION_LETTER_COLORS = new_colorpair(COLOR_BLUE, COLOR_BLACK) | A_BOLD;
|
||||||
|
DESCRIPTION_NUMBER_COLORS = new_colorpair(COLOR_CYAN, COLOR_BLACK) | A_BOLD;
|
||||||
|
DESCRIPTION_SYMBOL_COLORS = new_colorpair(COLOR_WHITE, COLOR_BLACK) | A_BOLD;
|
||||||
OUTPUT_CHAR_COLORS = new_colorpair(COLOR_BLACK, COLOR_WHITE) | A_BOLD;
|
OUTPUT_CHAR_COLORS = new_colorpair(COLOR_BLACK, COLOR_WHITE) | A_BOLD;
|
||||||
OUTPUT_ESCAPE_COLORS = new_colorpair(COLOR_RED, COLOR_WHITE) | A_BOLD;
|
OUTPUT_ESCAPE_COLORS = new_colorpair(COLOR_RED, COLOR_WHITE) | A_BOLD;
|
||||||
OUTPUT_LABEL_COLORS = new_colorpair(COLOR_BLACK, COLOR_YELLOW);
|
OUTPUT_LABEL_COLORS = new_colorpair(COLOR_BLACK, COLOR_YELLOW);
|
||||||
SEARCH_BAR_COLORS = new_colorpair(COLOR_BLACK, COLOR_GREEN);
|
BROWSE_MODE_COLORS = new_colorpair(COLOR_BLACK, COLOR_YELLOW);
|
||||||
BROWSE_MODE_COLORS = new_colorpair(COLOR_BLACK, COLOR_BLUE);
|
|
||||||
INSERT_MODE_COLORS = new_colorpair(COLOR_WHITE, COLOR_RED) | A_BOLD;
|
INSERT_MODE_COLORS = new_colorpair(COLOR_WHITE, COLOR_RED) | A_BOLD;
|
||||||
SEARCH_MODE_COLORS = new_colorpair(COLOR_WHITE, COLOR_GREEN) | A_BOLD;
|
SEARCH_MODE_COLORS = new_colorpair(COLOR_BLACK, COLOR_BLUE);
|
||||||
|
|
||||||
size_t chunk = 256;
|
size_t chunk = 256;
|
||||||
size_t buf_size = chunk, buf_i = 0;
|
size_t buf_size = chunk, buf_i = 0;
|
||||||
@ -307,9 +310,9 @@ int main(int argc, char *argv[])
|
|||||||
printwattrs(title_colors, "%*s%s%*s", spacer, "", title, spacer+1, "");
|
printwattrs(title_colors, "%*s%s%*s", spacer, "", title, spacer+1, "");
|
||||||
|
|
||||||
if (mode == SEARCH_MODE) {
|
if (mode == SEARCH_MODE) {
|
||||||
attron(SEARCH_BAR_COLORS);
|
attron(SEARCH_MODE_COLORS);
|
||||||
mvprintw(H-1, 0, " Search:");
|
mvprintw(H-1, 0, " Search:");
|
||||||
attroff(SEARCH_BAR_COLORS);
|
attroff(SEARCH_MODE_COLORS);
|
||||||
addch(' ');
|
addch(' ');
|
||||||
printwattrs(OUTPUT_CHAR_COLORS, "%s", searchbuf);
|
printwattrs(OUTPUT_CHAR_COLORS, "%s", searchbuf);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user