From e5a577dcc1f907c176386349801523da159dde29 Mon Sep 17 00:00:00 2001 From: Bruce Cowan <bruce@bcowan.me.uk> Date: Sun, 25 Sep 2022 18:38:02 +0100 Subject: [PATCH] Handle dark theme for blob border colours --- src/rugby-possibility-widget.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/rugby-possibility-widget.c b/src/rugby-possibility-widget.c index 624088a..784d708 100644 --- a/src/rugby-possibility-widget.c +++ b/src/rugby-possibility-widget.c @@ -6,6 +6,8 @@ #include <config.h> +#include <adwaita.h> + #include "rugby-possibility-widget.h" struct _RugbyPossibilityWidget @@ -74,7 +76,8 @@ rugby_possibility_widget_set_property (GObject *object, } static void -render_bar (GtkSnapshot *snapshot, +render_bar (GtkWidget *widget, + GtkSnapshot *snapshot, float x, float w, float h, @@ -93,11 +96,17 @@ render_bar (GtkSnapshot *snapshot, &area); gtk_snapshot_pop (snapshot); - GdkRGBA black = { 0.0, 0.0, 0.0, 0.2 }; + GtkStyleContext *ctx = gtk_widget_get_style_context (widget); + GdkRGBA border_colour; + gtk_style_context_lookup_color (ctx, "card_fg_color", &border_colour); + gtk_snapshot_append_border (snapshot, &rounded, (float[]) { 2.0, 2.0, 2.0, 2.0 }, - (GdkRGBA[]) { black, black, black, black }); + (GdkRGBA[]) { border_colour, + border_colour, + border_colour, + border_colour }); } static void @@ -130,7 +139,7 @@ rugby_possibility_widget_snapshot (GtkWidget *widget, for (int i = 0; i < tries; i++) { gtk_style_context_lookup_color (ctx, "green_3", &rgba); - render_bar (snapshot, x, w, height, rgba); + render_bar (widget, snapshot, x, w, height, rgba); x += w; } @@ -139,7 +148,7 @@ rugby_possibility_widget_snapshot (GtkWidget *widget, for (int i = 0; i < utries; i++) { gtk_style_context_lookup_color (ctx, "red_3", &rgba); - render_bar (snapshot, x, w, height, rgba); + render_bar (widget, snapshot, x, w, height, rgba); x += w; } @@ -148,7 +157,7 @@ rugby_possibility_widget_snapshot (GtkWidget *widget, for (int i = 0; i < kicks; i++) { gtk_style_context_lookup_color (ctx, "yellow_3", &rgba); - render_bar (snapshot, x, w, height, rgba); + render_bar (widget, snapshot, x, w, height, rgba); x += w; } } -- GitLab