From 4e78c447e48de398a0b30e2b33f1be7b7de8c5c4 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sun, 11 Dec 2016 22:25:37 +0100 Subject: [PATCH] Fix the wrong background color for profiles using system colours --- terminatorlib/terminator.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py index 4ad0055b..731942c1 100755 --- a/terminatorlib/terminator.py +++ b/terminatorlib/terminator.py @@ -414,11 +414,19 @@ class Terminator(Borg): profiles = self.config.base.profiles for profile in profiles.keys(): if profiles[profile]['use_theme_colors']: - # FIXME: This dummy vte has different system colors to the real ones - bgcolor = Vte.Terminal().get_style_context().get_background_color(Gtk.StateType.NORMAL) + # Create a dummy window/vte and realise it so it has correct + # values to read from + tmp_win = Gtk.Window() + tmp_vte = Vte.Terminal() + tmp_win.add(tmp_vte) + tmp_win.realize() + bgcolor = tmp_vte.get_style_context().get_background_color(Gtk.StateType.NORMAL) bgcolor = "#{0:02x}{1:02x}{2:02x}".format(int(bgcolor.red * 255), int(bgcolor.green * 255), int(bgcolor.blue * 255)) + tmp_win.remove(tmp_vte) + del(tmp_vte) + del(tmp_win) else: bgcolor = Gdk.RGBA() bgcolor = profiles[profile]['background_color']