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:
@ -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")
|
||||
|
Reference in New Issue
Block a user