[gnome-power-manager: 1/2] egg-graph: use theme color for axes label text




commit 0aed982c417c206901b1f00b95b718bd44a00632
Author: Gustavo Noronha Silva <gustavo noronha collabora com>
Date:   Sun Mar 13 13:10:19 2022 -0300

    egg-graph: use theme color for axes label text
    
    The labels were not readable when using dark themes, since it was using a
    hard-coded color.

 src/egg-graph-widget.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/src/egg-graph-widget.c b/src/egg-graph-widget.c
index 2a99053c..4a533e7a 100644
--- a/src/egg-graph-widget.c
+++ b/src/egg-graph-widget.c
@@ -502,11 +502,15 @@ egg_graph_widget_draw_labels (EggGraphWidget *graph, cairo_t *cr)
        PangoRectangle ink_rect, logical_rect;
        gdouble offsetx = 0;
        gdouble offsety = 0;
+       GtkStyleContext *style_context = gtk_widget_get_style_context (GTK_WIDGET (graph));
+       GdkRGBA text_color;
+
+       gtk_style_context_get_color(style_context, GTK_STATE_FLAG_NORMAL, &text_color);
 
        cairo_save (cr);
 
        /* do x text */
-       cairo_set_source_rgb (cr, 0.2f, 0.2f, 0.2f);
+       cairo_set_source_rgb (cr, text_color.red, text_color.green, text_color.blue);
        for (i = 0; i < priv->divs_x + 1; i++) {
                g_autofree gchar *text = NULL;
                b = priv->box_x + ((gdouble) i * divwidth);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]