From 4afabfe7a056ae6be0b8fd9912d1fdba6056f73a Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Fri, 5 Jul 2019 13:50:56 +0200 Subject: dark mode detect tweak --- gload.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'gload.c') diff --git a/gload.c b/gload.c index acacc48..211288d 100644 --- a/gload.c +++ b/gload.c @@ -130,7 +130,7 @@ static gboolean gload_draw(GtkWidget *widget, cairo_t *cr, gpointer data) gload *gl = data; GtkStyleContext *context; GdkRGBA normal, dimmed; - guint width, height, i, idx, max; + guint width, height, i, idx, max, brightness; bool darkmode; context = gtk_widget_get_style_context(widget); @@ -138,7 +138,12 @@ static gboolean gload_draw(GtkWidget *widget, cairo_t *cr, gpointer data) height = gtk_widget_get_allocated_height(widget); gtk_style_context_get_color(context, GTK_STATE_FLAG_NORMAL, &normal); - darkmode = gload_brightness(&normal) > 50; + brightness = gload_brightness(&normal); + darkmode = brightness > 50; +#if 0 + fprintf(stderr, "%s: foreground brightness %d/100 -> darkmode %s\n", __func__, + brightness, darkmode ? "yes" : "no"); +#endif if (darkmode) gload_darken(&normal, &dimmed, 30); else -- cgit