From f1abd792d510af76da72600007b09bcc2b748989 Mon Sep 17 00:00:00 2001 From: Haz Date: Thu, 29 Jul 2021 00:34:03 +0000 Subject: Add ansi escaping values and theming keyword for dimmed text This adds `[not]dim` to the set of accepted theme keywords --- ui-terminal-curses.c | 1 + ui-terminal-vt100.c | 2 ++ ui-terminal.c | 4 ++++ 3 files changed, 7 insertions(+) diff --git a/ui-terminal-curses.c b/ui-terminal-curses.c index e9f726b..0e7a4f1 100644 --- a/ui-terminal-curses.c +++ b/ui-terminal-curses.c @@ -35,6 +35,7 @@ #define CELL_ATTR_BLINK A_BLINK #define CELL_ATTR_BOLD A_BOLD #define CELL_ATTR_ITALIC A_ITALIC +#define CELL_ATTR_DIM A_DIM #ifdef NCURSES_VERSION # ifndef NCURSES_EXT_COLORS diff --git a/ui-terminal-vt100.c b/ui-terminal-vt100.c index 33ad7fb..3c785b8 100644 --- a/ui-terminal-vt100.c +++ b/ui-terminal-vt100.c @@ -69,6 +69,7 @@ #define CELL_ATTR_BLINK (1 << 2) #define CELL_ATTR_BOLD (1 << 3) #define CELL_ATTR_ITALIC (1 << 4) +#define CELL_ATTR_DIM (1 << 5) typedef struct { UiTerm uiterm; @@ -120,6 +121,7 @@ static void ui_vt100_blit(UiTerm *tui) { char on[4], off[4]; } cell_attrs[] = { { CELL_ATTR_BOLD, "1", "22" }, + { CELL_ATTR_DIM, "2", "22" }, { CELL_ATTR_ITALIC, "3", "23" }, { CELL_ATTR_UNDERLINE, "4", "24" }, { CELL_ATTR_BLINK, "5", "25" }, diff --git a/ui-terminal.c b/ui-terminal.c index babc5a6..264c6d3 100644 --- a/ui-terminal.c +++ b/ui-terminal.c @@ -171,6 +171,10 @@ static bool ui_style_define(UiWin *w, int id, const char *style) { cell_style.attr |= CELL_ATTR_BOLD; } else if (!strcasecmp(option, "notbold")) { cell_style.attr &= ~CELL_ATTR_BOLD; + } else if (!strcasecmp(option, "dim")) { + cell_style.attr |= CELL_ATTR_DIM; + } else if (!strcasecmp(option, "notdim")) { + cell_style.attr &= ~CELL_ATTR_DIM; } else if (!strcasecmp(option, "italics")) { cell_style.attr |= CELL_ATTR_ITALIC; } else if (!strcasecmp(option, "notitalics")) { -- cgit v1.2.3