[gnome-calendar] event-widget: Use .dim-label instead of a hard-coded opacity



commit bed7f9e027679e93d32bdc77d1e0f3acda232725
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Thu Jun 23 11:26:21 2022 +0200

    event-widget: Use .dim-label instead of a hard-coded opacity
    
    This uses the standard opacity for events of lower importance and
    ensures the opacity difference is lower in HighContrast, helping
    accessibility.

 src/gui/gcal-event-widget.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/src/gui/gcal-event-widget.c b/src/gui/gcal-event-widget.c
index 447f4bab..c75b2f4a 100644
--- a/src/gui/gcal-event-widget.c
+++ b/src/gui/gcal-event-widget.c
@@ -188,7 +188,10 @@ update_color (GcalEventWidget *self)
   date_compare = g_date_time_compare (self->dt_end, now);
 
   /* Fades out an event that's earlier than the current date */
-  gtk_widget_set_opacity (GTK_WIDGET (self), date_compare < 0 ? 0.6 : 1.0);
+  if (date_compare < 0)
+    gtk_widget_add_css_class (GTK_WIDGET (self), "dim-label");
+  else
+    gtk_widget_remove_css_class (GTK_WIDGET (self), "dim-label");
 
   /* Remove the old style class */
   if (self->css_class)


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