commit - ab728b01d1279e1be73604998298534a5462a72a
commit + 33d904b669e543d144ac195a28f32de6b6785117
blob - 42f48f272ee60d069863adf47105bb414c951585
blob + efb9ffd1f8d90a860135b09baaed0d1e44a5f58d
--- ChangeLog
+++ ChangeLog
2021-06-22 Omar Polo <op@omarpolo.com>
+ * defaults.c (config_setcolor): allow changing the colors/attributes of the tabline
+
* parse.y (attrname): allow changing the attributes
2021-06-21 Omar Polo <op@omarpolo.com>
blob - 66f9250a76777dd8e067b8723cfe5365d506b210
blob + 0201ef37baecb1f745a2bb18192eba62d2eadae1
--- defaults.c
+++ defaults.c
};
struct tab_face tab_face = {
- .background = A_REVERSE,
- .tab = A_REVERSE,
- .current_tab = A_NORMAL,
+ .bg_attr = A_REVERSE, .bg_bg = -1, .bg_fg = -1,
+ .t_attr = A_REVERSE, .t_bg = -1, .t_fg = -1,
+ .c_attr = A_NORMAL, .c_bg = -1, .c_fg = -1,
+
+ /*
+ * set these so that even when enable-color=0 the bar has some
+ * sane defaults.
+ */
+ .background = A_REVERSE,
+ .tab = A_REVERSE,
+ .current = A_NORMAL,
};
struct body_face body_face = {
struct mapping *m;
struct lineface_descr *d;
- if (has_prefix(name, "line.")) {
+ if (!strcmp(name, "tabline")) {
+ if (bg)
+ tab_face.bg_bg = prfx;
+ else
+ tab_face.bg_fg = prfx;
+ } else if (has_prefix(name, "tabline.")) {
+ name += 8;
+
+ if (!strcmp(name, "tab")) {
+ if (bg)
+ tab_face.t_bg = prfx;
+ else
+ tab_face.t_fg = prfx;
+ } else if (!strcmp(name, "current")) {
+ if (bg)
+ tab_face.c_bg = prfx;
+ else
+ tab_face.c_fg = prfx;
+ } else
+ return 0;
+ } else if (has_prefix(name, "line.")) {
name += 5;
if ((m = mapping_by_name(name)) == NULL)
struct mapping *m;
struct lineface_descr *d;
- if (has_prefix(name, "line.")) {
+ if (!strcmp(name, "tabline")) {
+ tab_face.bg_attr = prfx;
+ } else if (has_prefix(name, "tabline.")) {
+ name += 8;
+
+ if (!strcmp(name, "tab"))
+ tab_face.t_attr = prfx;
+ else if (!strcmp(name, "current"))
+ tab_face.c_attr = prfx;
+ else
+ return 0;
+ } else if (has_prefix(name, "line.")) {
name += 5;
if ((m = mapping_by_name(name)) == NULL)
f->trail_prop = COLOR_PAIR(d->tp) | d->trail_attr;
}
+ /* tab line */
+ init_pair(PTL_BG, tab_face.bg_fg, tab_face.bg_bg);
+ tab_face.background = COLOR_PAIR(PTL_BG) | tab_face.bg_attr;
+
+ init_pair(PTL_TAB, tab_face.t_fg, tab_face.t_bg);
+ tab_face.tab = COLOR_PAIR(PTL_TAB) | tab_face.t_attr;
+
+ init_pair(PTL_CURR, tab_face.c_fg, tab_face.c_bg);
+ tab_face.current = COLOR_PAIR(PTL_CURR) | tab_face.c_attr;
+
+ /* body */
init_pair(PBODY, body_face.fg, body_face.bg);
body_face.body = COLOR_PAIR(PBODY);
blob - 5a4e64ec3846d5b3e012470a862e6d4e9d44814d
blob + a9c72168f9204fe2900169f3c3bd4872669e08fa
--- telescope.h
+++ telescope.h
extern struct line_face line_faces[];
struct tab_face {
- int background, tab, current_tab;
+ int bg_attr, bg_bg, bg_fg;
+ int t_attr, t_bg, t_fg;
+ int c_attr, c_bg, c_fg;
+
+ int background, tab, current;
};
extern struct tab_face tab_face;
extern int in_minibuffer;
enum pairs {
- PBODY = 1,
+ PTL_BG = 1,
+ PTL_TAB,
+ PTL_CURR,
+
+ PBODY,
PBLEFT,
PBRIGHT,
blob - b7b531e3a7d7c090ca22a3090cc98e3f79bf23cd
blob + 81b7a7a5f38242ca6403f3d5ede068f4cdb40d5c
--- ui.c
+++ ui.c
}
if (current)
- wattron(tabline, tab_face.current_tab);
+ wattron(tabline, tab_face.current);
else
wattron(tabline, tab_face.tab);
wprintw(tabline, " ");
if (current)
- wattroff(tabline, tab_face.current_tab);
+ wattroff(tabline, tab_face.current);
else
wattroff(tabline, tab_face.tab);
}
waddch(tabline, ' ');
if (truncated)
mvwprintw(tabline, 0, COLS-1, ">");
+ wattroff(tabline, tab_face.background);
}
static void
body_lines = LINES-3;
body_cols = COLS;
+
wbkgd(body, body_face.body);
update_x_offset();