Fix the wrong background color for profiles using system colours

This commit is contained in:
Stephen Boddy 2016-12-11 22:25:37 +01:00
parent 117c5c8f0d
commit 4e78c447e4
1 changed files with 10 additions and 2 deletions

View File

@ -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']