Skip to content

Commit

Permalink
add alternative color
Browse files Browse the repository at this point in the history
added alternative table line color for better view
  • Loading branch information
ManojTGN committed Apr 13, 2024
1 parent 4e43982 commit c690a60
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 3 additions & 1 deletion headers/ascii.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@

#define MAX_COL 4
#define MAX_ROW 32
#define YEL "\x1b[33m"
#define GRAY "\x1B[38;5;243m"
#define GOLD "\x1B[38;5;220m"
#define YEL "\x1B[38;5;172m"
#define RESET "\x1b[0m"

typedef struct parameter{
Expand Down
4 changes: 3 additions & 1 deletion src/ascii.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@

#define MAX_COL 4
#define MAX_ROW 32
#define YEL "\x1b[33m"
#define GRAY "\x1B[38;5;243m"
#define GOLD "\x1B[38;5;220m"
#define YEL "\x1B[38;5;172m"
#define RESET "\x1b[0m"

typedef struct parameter{
Expand Down
8 changes: 6 additions & 2 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ void printData(asciiParams params){
procCol = currCol;
}

if(s%2 == 0){
strcat(lines[currRow],GRAY);
}

if(params.onlyOct || params._onlyAll){
snprintf(tmp, sizeof(tmp), "%03o ", params.content[s]);
strcat(lines[currRow],tmp);
Expand Down Expand Up @@ -72,12 +76,12 @@ void printData(asciiParams params){
}

if(isPrintable(params.content[s])){
snprintf(tmp, sizeof(tmp),YEL"%c "RESET, params.content[s]);
snprintf(tmp, sizeof(tmp),s%2==0?YEL"%c "RESET:GOLD"%c "RESET, params.content[s]);
currLineLength = 0;
}else{
char* print = getPrintable(params.content[s]);
currLineLength = strlen(print) - 3;
snprintf(tmp, sizeof(tmp),YEL"%s"RESET, print);
snprintf(tmp, sizeof(tmp),s%2==0?YEL"%s"RESET:GOLD"%s"RESET, print);
}
if(params.onlyChar || params._onlyAll) strcat(lines[currRow],tmp);

Expand Down

0 comments on commit c690a60

Please sign in to comment.