Reputation: 12018
How to change background color of GtkTextView? I tried with normal widget set bg functionality but gtk is just changing border color of GtkText View.
Plus can some some please explain me with simple example, that how to change Text Color/Font/Text Size in GtkTextView (Whole text in GtkTextView)?
I fond some examples but they are not working..
Thnaks, PP.
Upvotes: 3
Views: 9018
Reputation: 9173
As of gtk3, I believe the proper way to do that is through CSS. Register a gtk style sheet though GtkCssProvider, then you can write this CSS:
textview text {
background-color: @theme_bg_color;
}
We can see the relevant CSS nodes in the documentation for GtkTextView. In this case I put @theme_bg_color
which is an adwaita CSS variable, but you can as well put anything that goes in a usual CSS file, like red
or #ff0000
.
Upvotes: 1
Reputation: 3408
gtk_widget_override_background_color()
This the GTK 3.x+ way (until GTK 3.16). From
https://developer.gnome.org/gtk3/unstable/GtkWidget.html#gtk-widget-modify-base
"gtk_widget_modify_base
has been deprecated since version 3.0 and should not be used in newly-written code. Use gtk_widget_override_background_color()
instead"
UPDATE: thegtknerd notes that this method too is now deprecated and it has been since 3.16.
Upvotes: 5
Reputation:
gtk_widget_modify_base()
http://library.gnome.org/devel/gtk/unstable/GtkWidget.html#gtk-widget-modify-base
Upvotes: 4