Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Outline and Padding to have their own configurable colors #36

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,11 @@ static int config_setting_lookup_colors(const config_setting_t *setting,
config_setting_lookup_color(colorspec_setting, "bg",
&(value->bg)) &&
config_setting_lookup_color(
colorspec_setting, "border", &(value->border));
colorspec_setting, "border", &(value->border)) &&
config_setting_lookup_color(
colorspec_setting, "padding", &(value->padding)) &&
config_setting_lookup_color(
colorspec_setting, "outline", &(value->outline));
}

return success_status;
Expand Down
58 changes: 58 additions & 0 deletions src/conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ typedef struct
Color fg;
Color bg;
Color border;
Color padding;
Color outline;
} Colors;

typedef struct
Expand Down Expand Up @@ -122,6 +124,20 @@ typedef struct
.green = 0xff,\
.blue = 0xff,\
.alpha = 0xff\
},\
.padding = \
{ \
.red = 0x00,\
.green = 0x00,\
.blue = 0x00,\
.alpha = 0x90\
},\
.outline = \
{ \
.red = 0x00,\
.green = 0x00,\
.blue = 0x00,\
.alpha = 0x90\
}\
},\
.overflow =\
Expand All @@ -146,6 +162,20 @@ typedef struct
.green = 0x00,\
.blue = 0x00,\
.alpha = 0xff\
},\
.padding = \
{ \
.red = 0x00,\
.green = 0x00,\
.blue = 0x00,\
.alpha = 0x90\
},\
.outline = \
{ \
.red = 0x00,\
.green = 0x00,\
.blue = 0x00,\
.alpha = 0x90\
}\
},\
.alt =\
Expand All @@ -170,6 +200,20 @@ typedef struct
.green = 0x55,\
.blue = 0x55,\
.alpha = 0xff\
},\
.padding = \
{ \
.red = 0x00,\
.green = 0x00,\
.blue = 0x00,\
.alpha = 0x90\
},\
.outline = \
{ \
.red = 0x00,\
.green = 0x00,\
.blue = 0x00,\
.alpha = 0x90\
}\
},\
.altoverflow =\
Expand All @@ -194,6 +238,20 @@ typedef struct
.green = 0x00,\
.blue = 0x00,\
.alpha = 0xff\
},\
.padding = \
{ \
.red = 0x00,\
.green = 0x00,\
.blue = 0x00,\
.alpha = 0x90\
},\
.outline = \
{ \
.red = 0x00,\
.green = 0x00,\
.blue = 0x00,\
.alpha = 0x90\
}\
}\
}\
Expand Down
4 changes: 2 additions & 2 deletions src/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ static int size_y(Geometry_context g)
static void draw_empty(X_context x, Geometry_context g, Colors colors)
{
/* Outline */
fill_rectangle(x, colors.bg, 0, 0,
fill_rectangle(x, colors.outline, 0, 0,
2 * (g.outline + g.border + g.padding) + size_x(g),
2 * (g.outline + g.border + g.padding) + size_y(g));
/* Border */
fill_rectangle(x, colors.border, g.outline, g.outline,
2 * (g.border + g.padding) + size_x(g),
2 * (g.border + g.padding) + size_y(g));
/* Padding */
fill_rectangle(x, colors.bg, g.outline + g.border, g.outline + g.border,
fill_rectangle(x, colors.padding, g.outline + g.border, g.outline + g.border,
2 * g.padding + size_x(g), 2 * g.padding + size_y(g));
}

Expand Down
8 changes: 8 additions & 0 deletions styles.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,29 @@ default = {
fg = "#ffffff";
bg = "#00000090";
border = "#ffffff";
padding = "#00000090";
outline = "#00000090";
};
alt = {
fg = "#555555";
bg = "#00000090";
border = "#555555";
padding = "#00000090";
outline = "#00000090";
};
overflow = {
fg = "#ff0000";
bg = "#00000090";
border = "#ff0000";
padding = "#00000090";
outline = "#00000090";
};
altoverflow = {
fg = "#550000";
bg = "#00000090";
border = "#550000";
padding = "#00000090";
outline = "#00000090";
};
};
};