mirror of
https://github.com/FelixKratz/SketchyBar
synced 2024-11-10 22:04:28 +00:00
background colors working, but more precision needed
This commit is contained in:
parent
4ea3f34238
commit
1ca51e31e3
3 changed files with 6 additions and 2 deletions
|
@ -183,7 +183,7 @@ void bar_draw_background(struct bar* bar) {
|
|||
void bar_draw_item_background(struct bar* bar, struct bar_item* bar_item, uint32_t sid) {
|
||||
CGRect draw_region = {{bar_item->bounding_rects[sid - 1]->origin.x, bar->frame.origin.y}, {bar_item->bounding_rects[sid - 1]->size.width, bar->frame.size.height}};
|
||||
CGContextClearRect(bar->context, draw_region);
|
||||
CGContextSetRGBFillColor(bar->context, bar_item->icon_color.r, bar_item->icon_color.g, bar_item->icon_color.b, bar_item->icon_color.a);
|
||||
CGContextSetRGBFillColor(bar->context, bar_item->background_color.r, bar_item->background_color.g, bar_item->background_color.b, bar_item->background_color.a);
|
||||
|
||||
CGMutablePathRef path = CGPathCreateMutable();
|
||||
CGPathAddRect(path, NULL, draw_region);
|
||||
|
@ -261,7 +261,7 @@ void bar_refresh(struct bar* bar) {
|
|||
bar_item_set_bounding_rect_for_space(bar_item, sid, bar->origin);
|
||||
|
||||
// Actual drawing
|
||||
//bar_draw_item_background(bar, bar_item, sid);
|
||||
bar_draw_item_background(bar, bar_item, sid);
|
||||
bar_draw_line(bar, *icon, icon_position.x, icon_position.y);
|
||||
bar_draw_line(bar, *label, label_position.x, label_position.y);
|
||||
bar_draw_graph(bar, bar_item, graph_x, graph_rtl);
|
||||
|
|
|
@ -40,6 +40,7 @@ void bar_item_init(struct bar_item* bar_item, struct bar_item* default_item) {
|
|||
bar_item->label_highlight_color = rgba_color_from_hex(0xffffffff);
|
||||
bar_item->has_graph = false;
|
||||
bar_item->num_rects = 0;
|
||||
bar_item->background_color = rgba_color_from_hex(0x44ff0000);
|
||||
bar_item->bounding_rects = NULL;
|
||||
|
||||
if (default_item) {
|
||||
|
|
|
@ -37,6 +37,9 @@ struct bar_item {
|
|||
// The position in the bar: l,r,c
|
||||
char position;
|
||||
|
||||
// Background
|
||||
struct rgba_color background_color;
|
||||
|
||||
// Icon properties
|
||||
bool icon_highlight;
|
||||
struct bar_line icon_line;
|
||||
|
|
Loading…
Reference in a new issue