aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2021-06-25 13:06:32 +0200
committerOmar Polo <op@omarpolo.com>2021-06-25 13:06:32 +0200
commit24221637d6a753df4ca2173e4f1f6593a901696a (patch)
treeffc4e8b7d11d26b6f5849c8dbbd0247c88f050f8
parent74bc52e8eebffb1325a73fbb0e6a62c677c2a0a0 (diff)
downloadtelescope-24221637d6a753df4ca2173e4f1f6593a901696a.tar.gz
telescope-24221637d6a753df4ca2173e4f1f6593a901696a.tar.bz2
allow styling the minibuffer and modeline too
-rw-r--r--defaults.c31
-rw-r--r--telescope.h6
-rw-r--r--ui.c1
3 files changed, 36 insertions, 2 deletions
diff --git a/defaults.c b/defaults.c
index 153c17f..79c8f39 100644
--- a/defaults.c
+++ b/defaults.c
@@ -118,11 +118,15 @@ struct body_face body_face = {
};
struct modeline_face modeline_face = {
- .background = A_REVERSE,
+ .bg = -1,
+ .fg = -1,
+ .attr = A_REVERSE,
};
struct minibuffer_face minibuffer_face = {
- .background = A_NORMAL,
+ .bg = -1,
+ .fg = -1,
+ .attr = A_NORMAL,
};
struct mapping {
@@ -273,6 +277,16 @@ config_setcolor(int bg, const char *name, int prfx, int line, int trail)
body_face.fg = line;
body_face.rfg = trail;
}
+ } else if (!strcmp(name, "minibuffer")) {
+ if (bg)
+ minibuffer_face.bg = prfx;
+ else
+ minibuffer_face.fg = prfx;
+ } else if (!strcmp(name, "modeline")) {
+ if (bg)
+ modeline_face.bg = prfx;
+ else
+ modeline_face.fg = prfx;
} else {
return 0;
}
@@ -308,6 +322,10 @@ config_setattr(const char *name, int prfx, int line, int trail)
f->prfx_attr = prfx;
f->attr = line;
f->trail_attr = trail;
+ } else if (!strcmp(name, "minibuffer")) {
+ minibuffer_face.attr = prfx;
+ } else if (!strcmp(name, "modeline")) {
+ modeline_face.attr = prfx;
} else {
return 0;
}
@@ -366,4 +384,13 @@ config_apply_style(void)
tl_init_pair(colors, PBRIGHT, body_face.rfg, body_face.rbg);
body_face.right = COLOR_PAIR(PBRIGHT);
+
+ /* modeline */
+ tl_init_pair(colors, PMODELINE, modeline_face.fg, modeline_face.bg);
+ modeline_face.background = COLOR_PAIR(PMODELINE) | modeline_face.attr;
+
+ /* minibuffer */
+ tl_init_pair(colors, PMINIBUF, minibuffer_face.fg, minibuffer_face.bg);
+ minibuffer_face.background = COLOR_PAIR(PMINIBUF) | minibuffer_face.attr;
+
}
diff --git a/telescope.h b/telescope.h
index 7aab450..d162708 100644
--- a/telescope.h
+++ b/telescope.h
@@ -99,11 +99,13 @@ struct body_face {
extern struct body_face body_face;
struct modeline_face {
+ int bg, fg, attr;
int background;
};
extern struct modeline_face modeline_face;
struct minibuffer_face {
+ int bg, fg, attr;
int background;
};
extern struct minibuffer_face minibuffer_face;
@@ -424,6 +426,10 @@ enum pairs {
PPEND,
PPEND_PRFX,
PPEND_TRAIL,
+
+ PMODELINE,
+
+ PMINIBUF,
};
struct thiskey {
diff --git a/ui.c b/ui.c
index 67ed7a7..1f1d656 100644
--- a/ui.c
+++ b/ui.c
@@ -1461,6 +1461,7 @@ ui_init(int argc, char * const *argv)
body_cols = COLS;
wbkgd(body, body_face.body);
+ wbkgd(minibuf, minibuffer_face.background);
update_x_offset();