diff options
author | wrmr | 2025-06-24 23:03:32 -0400 |
---|---|---|
committer | wrmr | 2025-06-24 23:05:56 -0400 |
commit | c24854d8e758a771061f49333dadecd7321f251e (patch) | |
tree | d31268c6246335c91e431493e89193dc05747ff2 /main.c | |
parent | b25748bda091d2d35e5600024379b17ea81fc97f (diff) |
clean up color pair stuff with some x macros
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/main.c b/main.c index 04558b7..9923385 100644 --- a/main.c +++ b/main.c @@ -46,14 +46,22 @@ /* colors */ -#define CPAIR_TEXT 0 -#define CPAIR_USER 1 -#define CPAIR_TIME 2 -#define CPAIR_MENTION 3 -#define CPAIR_BORDER 4 -#define CPAIR_TAGLINE_OK 5 -#define CPAIR_TAGLINE_WARN 6 -#define CPAIR_TAGLINE_ERR 7 +typedef enum { + CPAIR_TEXT, CPAIR_MENTION, + CPAIR_USER, CPAIR_TIME, CPAIR_BORDER, + CPAIR_TAGLINE_OK, CPAIR_TAGLINE_WARN, CPAIR_TAGLINE_ERR +} ColorPair; + +#define CPAIR_INIT_X(cp, fg, bg) init_pair(cp, fg, bg); +#define CPAIR_LIST\ + X(CPAIR_TEXT , COLOR_WHITE , COLOR_BLACK)\ + X(CPAIR_MENTION , COLOR_BLACK , COLOR_WHITE)\ + X(CPAIR_USER , COLOR_YELLOW , COLOR_BLACK)\ + X(CPAIR_TIME , COLOR_BLUE , COLOR_BLACK)\ + X(CPAIR_BORDER , COLOR_BLUE , COLOR_BLACK)\ + X(CPAIR_TAGLINE_OK , COLOR_GREEN , COLOR_BLACK)\ + X(CPAIR_TAGLINE_WARN , COLOR_YELLOW , COLOR_BLACK)\ + X(CPAIR_TAGLINE_ERR , COLOR_RED , COLOR_BLACK) /* dynamic arrays */ @@ -501,14 +509,9 @@ void init_curses(void) { keypad(stdscr, TRUE); curs_set(0); - init_pair(CPAIR_TAGLINE_OK, COLOR_GREEN, COLOR_BLACK); - init_pair(CPAIR_TAGLINE_WARN, COLOR_YELLOW, COLOR_BLACK); - init_pair(CPAIR_TAGLINE_ERR, COLOR_RED, COLOR_BLACK); - init_pair(CPAIR_BORDER, COLOR_BLUE, COLOR_BLACK); - init_pair(CPAIR_USER, COLOR_YELLOW, COLOR_BLACK); - init_pair(CPAIR_TIME, COLOR_BLUE, COLOR_BLACK); - init_pair(CPAIR_TEXT, COLOR_WHITE, COLOR_BLACK); - init_pair(CPAIR_MENTION, COLOR_BLACK, COLOR_WHITE); +#define X CPAIR_INIT_X + CPAIR_LIST +#undef X } void fini_curses(void) { |