From 7334b53d833cd2695a3544ff166219e977138732 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sun, 20 Jun 2021 10:44:50 +0200 Subject: config: add csd.button-color option This option controls the foreground color of the minimize/maximize/close buttons. I.e. the color used to draw the minimize/maximize/close glyphs. It defaults to default background color. --- render.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'render.c') diff --git a/render.c b/render.c index 0bf09bd8..a1f9ee79 100644 --- a/render.c +++ b/render.c @@ -1580,10 +1580,24 @@ render_csd_border(struct terminal *term, enum csd_surface surf_idx) csd_commit(term, surf, buf); } +static pixman_color_t +get_csd_button_fg_color(const struct config *conf) +{ + uint32_t _color = conf->colors.bg; + uint16_t alpha = 0xffff; + + if (conf->csd.color.buttons_set) { + _color = conf->csd.color.buttons; + alpha = _color >> 24 | (_color >> 24 << 8); + } + + return color_hex_to_pixman_with_alpha(_color, alpha); +} + static void render_csd_button_minimize(struct terminal *term, struct buffer *buf) { - pixman_color_t color = color_hex_to_pixman(term->conf->colors.bg); + pixman_color_t color = get_csd_button_fg_color(term->conf); pixman_image_t *src = pixman_image_create_solid_fill(&color); const int max_height = buf->height / 2; @@ -1628,7 +1642,7 @@ static void render_csd_button_maximize_maximized( struct terminal *term, struct buffer *buf) { - pixman_color_t color = color_hex_to_pixman(term->conf->colors.bg); + pixman_color_t color = get_csd_button_fg_color(term->conf); pixman_image_t *src = pixman_image_create_solid_fill(&color); const int max_height = buf->height / 3; @@ -1656,7 +1670,7 @@ static void render_csd_button_maximize_window( struct terminal *term, struct buffer *buf) { - pixman_color_t color = color_hex_to_pixman(term->conf->colors.bg); + pixman_color_t color = get_csd_button_fg_color(term->conf); pixman_image_t *src = pixman_image_create_solid_fill(&color); const int max_height = buf->height / 2; @@ -1710,7 +1724,7 @@ render_csd_button_maximize(struct terminal *term, struct buffer *buf) static void render_csd_button_close(struct terminal *term, struct buffer *buf) { - pixman_color_t color = color_hex_to_pixman(term->conf->colors.bg); + pixman_color_t color = get_csd_button_fg_color(term->conf); pixman_image_t *src = pixman_image_create_solid_fill(&color); const int max_height = buf->height / 3; -- cgit v1.3