cgmnlm

colorful gemini line mode browser
git clone https://git.clttr.info/cgmnlm.git
Log (Feed) | Files | Refs (Tags) | README | LICENSE

commit b39e196040623a80bf9f1a0a05c3da8523e26ee3
parent 3270a74590d4bfbbc9ae1fdc4c1d36eed943844f
Author: René Wagner <rwagner@rw-net.de>
Date:   Tue,  5 Jan 2021 19:16:06 +0100

use light-gray for quotes

Diffstat:
MREADME.md | 10++++++++++
Msrc/cgmnlm.c | 19++++++++++---------
2 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/README.md b/README.md @@ -19,6 +19,16 @@ It includes the following modifications: - default 4 char indenting - colored headings & links +The actual colors used depend on your terminal palette: +- heading 1: light red +- heading 2: light yellow +- heading 3: light green +- gemini link: light cyan +- non-gemini link: light magenta +- quote: light gray + +Besides this rendering adjustments i'll try to keep track of upstream changes or send patches to upstream. + ## Dependencies: - A POSIX-like system and a C11 compiler diff --git a/src/cgmnlm.c b/src/cgmnlm.c @@ -19,12 +19,13 @@ #include <gmni/url.h> #include "util.h" -#define ANSI_COLOR_RED "\x1b[31m" -#define ANSI_COLOR_GREEN "\x1b[32m" -#define ANSI_COLOR_YELLOW "\x1b[33m" -#define ANSI_COLOR_BLUE "\x1b[34m" -#define ANSI_COLOR_MAGENTA "\x1b[35m" -#define ANSI_COLOR_CYAN "\x1b[36m" +#define ANSI_COLOR_RED "\x1b[91m" +#define ANSI_COLOR_GREEN "\x1b[92m" +#define ANSI_COLOR_YELLOW "\x1b[93m" +#define ANSI_COLOR_BLUE "\x1b[94m" +#define ANSI_COLOR_MAGENTA "\x1b[95m" +#define ANSI_COLOR_CYAN "\x1b[96m" +#define ANSI_COLOR_GRAY "\x1b[37m" #define ANSI_COLOR_RESET "\x1b[0m" struct link { @@ -791,7 +792,7 @@ repeat: break; case GEMINI_LINK: if (text == NULL) { - col += fprintf(out, "%2d) %s", nlinks++, (!strncmp("gemini://", tok.link.url, 9) || strstr(tok.link.url, "://") == NULL) ? ANSI_COLOR_CYAN : ANSI_COLOR_MAGENTA ); + col += fprintf(out, "%2d) %s", nlinks++, (!strncmp("gemini://", tok.link.url, 9) || strstr(tok.link.url, "://") == NULL) ? ANSI_COLOR_CYAN : ANSI_COLOR_MAGENTA); text = trim_ws(tok.link.text ? tok.link.text : tok.link.url); *next = calloc(1, sizeof(struct link)); (*next)->url = strdup(trim_ws(tok.link.url)); @@ -842,8 +843,8 @@ repeat: } break; case GEMINI_QUOTE: - col += fprintf(out, " %s ", - browser->unicode ? "┃" : ">"); + col += fprintf(out, " %s%s %s", ANSI_COLOR_RESET, + browser->unicode ? "┃" : ">", ANSI_COLOR_GRAY); if (text == NULL) { text = trim_ws(tok.quote_text); }