[gitg] Fix dark style of diff-stat widget



commit df2c6cdcf8c55e3e819809a8bc25129888a7a023
Author: Jesse van den Kieboom <jessevdk gnome org>
Date:   Mon Dec 21 22:33:46 2015 +0100

    Fix dark style of diff-stat widget

 libgitg/gitg-diff-stat.vala            |   14 ++++++++++++++
 libgitg/resources/ui/libgitg-style.css |   10 ++++++++++
 2 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/libgitg/gitg-diff-stat.vala b/libgitg/gitg-diff-stat.vala
index 9ce3716..6a59989 100644
--- a/libgitg/gitg-diff-stat.vala
+++ b/libgitg/gitg-diff-stat.vala
@@ -83,6 +83,20 @@ public class Gitg.DiffStat : Gtk.DrawingArea
 
                d_layout = null;
 
+               var settings = Gtk.Settings.get_default();
+               var theme = Environment.get_variable("GTK_THEME");
+
+               var dark = settings.gtk_application_prefer_dark_theme || (theme != null && 
theme.has_suffix(":dark"));
+
+               if (dark)
+               {
+                       get_style_context().add_class("dark");
+               }
+               else
+               {
+                       get_style_context().remove_class("dark");
+               }
+
                make_layout();
        }
 
diff --git a/libgitg/resources/ui/libgitg-style.css b/libgitg/resources/ui/libgitg-style.css
index b21a464..20b7441 100644
--- a/libgitg/resources/ui/libgitg-style.css
+++ b/libgitg/resources/ui/libgitg-style.css
@@ -59,6 +59,11 @@ GitgDiffStat.no-frame.added-only {
        border-radius: 3px 0px 0px 3px;
 }
 
+GitgDiffStat.added.dark,
+GitgDiffStat.added-only.dark {
+       background-color: rgb(78, 154, 6);
+}
+
 GitgDiffStat.added:dir(rtl),
 GitgDiffStat.no-frame.added:dir(rtl) {
        border-radius: 0px 3px 3px 0px;
@@ -72,6 +77,11 @@ GitgDiffStat.no-frame.removed-only {
        border-radius: 0px 3px 3px 0px;
 }
 
+GitgDiffStat.removed.dark,
+GitgDiffStat.removed-only.dark {
+       background-color: rgb(164, 0, 0);
+}
+
 GitgDiffStat.removed:dir(rtl),
 GitgDiffStat.no-frame.removed:dir(rtl) {
        border-radius: 3px 0px 0px 3px;


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