mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-04 09:53:25 +00:00
python: Use theme colors for console font color
Previously, the console's font color was hardcoded to #006000. This did not stand out well on darker theme. This patch pulls the widget's foreground color from GtkStyleContext to ensure it contrasts sufficiently with the console background color.
This commit is contained in:
parent
605acaa5f7
commit
f66c6e9681
1 changed files with 8 additions and 1 deletions
|
@ -137,7 +137,14 @@ class _ReadLine(object):
|
|||
self.do_insert = False
|
||||
self.do_delete = False
|
||||
|
||||
self.stdout_tag = self.buffer.create_tag("stdout", foreground="#006000")
|
||||
#Use the theme's color scheme for the text color
|
||||
font_color = self.get_style_context().get_property('color', Gtk.StateFlags.NORMAL)
|
||||
r = int (font_color.red * 255)
|
||||
g = int (font_color.green * 255)
|
||||
b = int (font_color.blue * 255)
|
||||
hex_font_color = "#" + '{r:02x}{g:02x}{b:02x}'.format (r = r, g = g, b = b)
|
||||
|
||||
self.stdout_tag = self.buffer.create_tag("stdout", foreground=hex_font_color)
|
||||
self.stderr_tag = self.buffer.create_tag("stderr", foreground="#B00000")
|
||||
self._stdout = _ReadLine.Output(self, "stdout")
|
||||
self._stderr = _ReadLine.Output(self, "stderr")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue