From 3854a7c0e2fb61fda7d683021735fe83cd3dce4d Mon Sep 17 00:00:00 2001 From: Kacper Kowalski Date: Fri, 3 Feb 2023 14:34:16 +0100 Subject: [PATCH] Allow setting hardcoded background darkening Normally, one can only change the background of the foreground for the inactive window. With this change the background of the inactive window will also change it's brightness by 20%. --- terminatorlib/terminal.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index 9f633a66..936bbc3e 100644 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -112,6 +112,7 @@ class Terminal(Gtk.VBox): fgcolor_active = None fgcolor_inactive = None bgcolor = None + bgcolor_inactive = None palette_active = None palette_inactive = None @@ -754,6 +755,13 @@ class Terminal(Gtk.VBox): dbg(("fgcolor_inactive set to: RGB(%s,%s,%s)", getattr(self.fgcolor_inactive, "red"), getattr(self.fgcolor_inactive, "green"), getattr(self.fgcolor_inactive, "blue"))) + + bg_factor = 0.8 + self.bgcolor_inactive = self.bgcolor.copy() + for bit in ['red', 'green', 'blue']: + setattr(self.bgcolor_inactive, bit, + getattr(self.bgcolor_inactive, bit) * bg_factor) + colors = self.config['palette'].split(':') self.palette_active = [] for color in colors: @@ -789,7 +797,7 @@ class Terminal(Gtk.VBox): self.vte.set_colors(self.fgcolor_active, self.bgcolor, self.palette_active) else: - self.vte.set_colors(self.fgcolor_inactive, self.bgcolor, + self.vte.set_colors(self.fgcolor_inactive, self.bgcolor_inactive, self.palette_inactive) profiles = self.config.base.profiles terminal_box_style_context = self.terminalbox.get_style_context() @@ -1314,7 +1322,7 @@ class Terminal(Gtk.VBox): def on_vte_focus_out(self, _widget, _event): """Inform other parts of the application when focus is lost""" - self.vte.set_colors(self.fgcolor_inactive, self.bgcolor, + self.vte.set_colors(self.fgcolor_inactive, self.bgcolor_inactive, self.palette_inactive) self.set_cursor_color() self.emit('focus-out')