From 1658bd82164c50cc048bae5a28cd223a7d45ff1e Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Sat, 9 Mar 2013 11:28:32 +0100 Subject: wlt: theme: change frame color to white plus black border It is currently pretty annoying to use multiple wlterm windows stacked on top on each other when the terminal-background is black. The border doesn't use multiple colors so it is hard to distinguish from the main-frame. This patch changes the border color to white (as most terminal-backgrounds are black by default) and additionally draws a black 1px frame around it. This guarantees that the frame is even visible with white terminal backgrounds. Signed-off-by: David Herrmann --- src/wlt_theme.c | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/wlt_theme.c b/src/wlt_theme.c index 63e8033..863746a 100644 --- a/src/wlt_theme.c +++ b/src/wlt_theme.c @@ -168,16 +168,22 @@ static void draw_control(struct wlt_theme *theme) static void draw_frame(struct wlt_theme *theme) { uint8_t *dst; - uint32_t *line; + uint32_t *line, col; unsigned int i, j, height; + col = (0x60 << 24) | (0xaa << 16) | (0xaa << 8) | 0xaa; + /* top frame */ dst = theme->buffer.data + theme->buffer.stride * theme->control_height; for (i = 0; i < theme->frame_width; ++i) { line = (uint32_t*)dst; - for (j = 0; j < theme->buffer.width; ++j) - line[j] = 0xa0 << 24; + for (j = 0; j < theme->buffer.width; ++j) { + if (!j || j + 1 == theme->buffer.width) + line[j] = 0xff << 24; + else + line[j] = col; + } dst += theme->buffer.stride; } @@ -186,8 +192,13 @@ static void draw_frame(struct wlt_theme *theme) (theme->buffer.height - theme->frame_width); for (i = 0; i < theme->frame_width; ++i) { line = (uint32_t*)dst; - for (j = 0; j < theme->buffer.width; ++j) - line[j] = 0xa0 << 24; + for (j = 0; j < theme->buffer.width; ++j) { + if (!j || j + 1 == theme->buffer.width + || i + 1 == theme->frame_width) + line[j] = 0xff << 24; + else + line[j] = col; + } dst += theme->buffer.stride; } @@ -199,7 +210,7 @@ static void draw_frame(struct wlt_theme *theme) for (i = 0; i < height; ++i) { line = (uint32_t*)dst; for (j = 0; j < theme->frame_width; ++j) - line[j] = 0xa0 << 24; + line[j] = j ? col : (0xff << 24); dst += theme->buffer.stride; } @@ -211,8 +222,12 @@ static void draw_frame(struct wlt_theme *theme) for (i = 0; i < height; ++i) { line = (uint32_t*)dst; line += theme->buffer.width - theme->frame_width; - for (j = 0; j < theme->frame_width; ++j) - line[j] = 0xa0 << 24; + for (j = 0; j < theme->frame_width; ++j) { + if (j + 1 == theme->frame_width) + line[j] = 0xff << 24; + else + line[j] = col; + } dst += theme->buffer.stride; } } -- cgit v1.2.3