diff options
| author | Louis Burda <quent.burda@gmail.com> | 2022-02-14 00:28:11 +0100 |
|---|---|---|
| committer | Louis Burda <quent.burda@gmail.com> | 2022-02-14 00:28:11 +0100 |
| commit | 72de33c4f15144e7c597fad850510dd7da88a0f2 (patch) | |
| tree | 7d349ba78f168359866b98b9424238d50e58e7f0 /src/style.c | |
| parent | 12b6c9dfd009352e0bb7f8395abd3678e3bd6265 (diff) | |
| download | tmus-72de33c4f15144e7c597fad850510dd7da88a0f2.tar.gz tmus-72de33c4f15144e7c597fad850510dd7da88a0f2.zip | |
Refactored main.c into many files
Diffstat (limited to 'src/style.c')
| -rw-r--r-- | src/style.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/style.c b/src/style.c new file mode 100644 index 0000000..3e7370f --- /dev/null +++ b/src/style.c @@ -0,0 +1,39 @@ +#include "style.h" + +#include <string.h> + +static int style_attrs[STYLE_COUNT]; + +void +style_init(void) +{ + memset(style_attrs, 0, sizeof(style_attrs)); + style_add(STYLE_DEFAULT, COLOR_WHITE, COLOR_BLACK, 0); + style_add(STYLE_TITLE, COLOR_WHITE, COLOR_BLUE, A_BOLD); + style_add(STYLE_PANE_SEP, COLOR_BLUE, COLOR_BLACK, 0); + style_add(STYLE_ITEM_SEL, COLOR_YELLOW, COLOR_BLACK, A_BOLD); + style_add(STYLE_ITEM_HOVER, COLOR_WHITE, COLOR_BLUE, 0); + style_add(STYLE_ITEM_HOVER_SEL, COLOR_YELLOW, COLOR_BLUE, A_BOLD); + style_add(STYLE_ERROR, COLOR_RED, COLOR_BLACK, 0); + style_add(STYLE_PREV, COLOR_WHITE, COLOR_BLACK, A_DIM); +} + +void +style_add(int style, int fg, int bg, int attr) +{ + style_attrs[style] = attr; + init_pair(style, fg, bg); +} + +void +style_on(WINDOW *win, int style) +{ + ATTR_ON(win, COLOR_PAIR(style) | style_attrs[style]); +} + +void +style_off(WINDOW *win, int style) +{ + ATTR_OFF(win, COLOR_PAIR(style) | style_attrs[style]); +} + |
