aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2019-07-05 13:50:56 +0200
committerGerd Hoffmann <kraxel@redhat.com>2019-07-05 13:52:10 +0200
commit4afabfe7a056ae6be0b8fd9912d1fdba6056f73a (patch)
tree35eefc843be5fc3bada7ce83976cd19dfe4a9082
parented416310bd42f78967893d6f333b6ddb0be456c7 (diff)
downloadgterm-4afabfe7a056ae6be0b8fd9912d1fdba6056f73a.tar.gz
dark mode detect tweak
-rw-r--r--gload.c9
1 files changed, 7 insertions, 2 deletions
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