diff options
author | Eduardo Chappa <chappa@washington.edu> | 2019-09-01 20:03:41 -0600 |
---|---|---|
committer | Eduardo Chappa <chappa@washington.edu> | 2019-09-01 20:03:41 -0600 |
commit | a7f1ee6fbe1aa46f7bcc0d40740e0b6c98a12692 (patch) | |
tree | b7d532e58f9a6164e9d76f79b4c2dbb0b81b8ba1 /pico | |
parent | 6076d5da019c37df48fb626d1b46bf242361388b (diff) | |
download | alpine-a7f1ee6fbe1aa46f7bcc0d40740e0b6c98a12692.tar.xz |
* Improvements to the pico manual as well as on the code that displays
the table of color codes.
Diffstat (limited to 'pico')
-rw-r--r-- | pico/main.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/pico/main.c b/pico/main.c index 68d5acf4..29f55924 100644 --- a/pico/main.c +++ b/pico/main.c @@ -516,6 +516,8 @@ display_color_codes(void) exit(1); } + if(ncolors & 1) ncolors--; /* eliminate transparent colors at this time */ + fprintf(stdout, "%s", "The code of a color is the number in the same row plus\r\n"); fprintf(stdout, "%s", "the number in the same column as that color.\r\n\r\n"); @@ -530,16 +532,14 @@ display_color_codes(void) } pico_toggle_color(1); - if(ncolors != 256){ + if(ncolors < 256){ for(k = -1; 16*k < ncolors; k++){ for(l = -1; l < ncolors; l++){ if(k == -1){ - if(ncolors == 8){ - if(l == -1) - fprintf(stdout, "%s", " "); - else - fprintf(stdout, "%3d", l); - } + if(l == -1) + fprintf(stdout, "%s", " "); + else + fprintf(stdout, "%3d", l); } else{ if(l == -1){ @@ -558,10 +558,9 @@ display_color_codes(void) } } pico_toggle_color(0); - if(k == 0) + if(k == -1) fprintf(stdout, " (%d colors)", ncolors); - if(k != -1 || ncolors == 8) - fprintf(stdout, "%s", "\r\n"); + fprintf(stdout, "%s", "\r\n"); } } else { fprintf(stdout, "%s", "Codes for terminal with 256 colors:\r\n"); |