I am writing an application using Vte in Python + Gtk3.
I am not able to change all the color.
For example, for the foreground color, I tried this code, but the text color doesn't change:
class Shell(Gtk.Box):
def __init__(self,on_close_button_cb,path = ""):
super(Shell,self).__init__(orientation=Gtk.Orientation.VERTICAL)
v = Vte.Terminal()
v.set_color_foreground(Gdk.Color(65535,0,0))
v.set_size(80,80)
v.show_all()
if path == "":
path = os.environ['HOME']
self.vpid = v.fork_command_full( Vte.PtyFlags.DEFAULT, path, ["/bin/bash"], [], GLib.SpawnFlags.DO_NOT_REAP_CHILD, None, None,)
self.pack_start(v,True,True,0)
self.set_visible(True)
Changing color of a Vte.Terminal() widget has to be done after the terminal widget has been realized. Otherwise color changes done with the set_colors(), set_color_foreground(), etc methods are not taken into account.
The following working example proposes two ways of doing this. The example uses a color palette and set_colors(), but the same holds if you would want to use the set_color_foreground() or other set_color_*() methods. Personally, I prefer option 1: