GTK+3 styles and themes

2014-04-01 Thread Roland Koebler
Hi,

in some situations, it's very useful to colorize some widgets, to improve
usability, e.g. a red background for invalid entries or buttons in different
colors. I know that this should be used rarely, but it *really* improves
usability in some cases.

In GTK+2, this was possible via modify_bg();
GTK+3 offers override_background_color() and CSS.
This works well on systems without themes.

But unfortunately, some system-themes seem to *completely* override *all*
these settings; no matter if I use override_background_color(), GtkCssProvider,
a high or low GTK_STYLE_PROVIDER_PRIORITY or a ~/.gtk-3.0.css-file --
especially Gnome3 and the Adwaita-theme of Xfce4 ignore *all these*!

So, is there *any* way to set widget-colors, so that the theme cannot
override them?

And is it a bug in GTK+3 or Gnome3/Xfce4, that ~/.gtk-3.0.css and all custom
GtkCssProviders are completely ignored?


thanks,
Roland
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GTK+3 styles and themes

2014-04-01 Thread Roland Koebler
Hi,

ok, I'm answering my own question -- maybe this is also helpful for someone
else:

Using custom stylesheets *does* work (although it still seems that
~/.gtk-3.0.css has no effect under Gnome3); but for some themes and
Gnome3, setting background-color doesn't have any effect, but setting
background seems to work.

Python example, which works here:

css = Gtk.CssProvider()
css.load_from_data(
GtkButton { background-color: #ff; background: #ff; }
)
screen = Gdk.Screen.get_default()
Gtk.StyleContext().add_provider_for_screen(screen, css, 
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)


Is there any documentation of this?
Especially when to use background-color and when to use background?
The GtkCssProvider-documentation only mentions background-color.


Roland
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GTK+3 styles and themes

2014-04-01 Thread Colomban Wendling
Le 01/04/2014 11:49, Roland Koebler a écrit :
 [...]
 
 Is there any documentation of this?
 Especially when to use background-color and when to use background?
 The GtkCssProvider-documentation only mentions background-color.

https://bugzilla.gnome.org/show_bug.cgi?id=656461

The problem is the same with CSS, if you set only the background color
and there is a background image, the modified color is just not visible.
 If you override the whole background, it removes the image and thus the
color is shown.

Hope it somewhat helps.

Regards,
Colomban
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: GTK+3 styles and themes

2014-04-01 Thread Liam R E Quin
On Tue, 2014-04-01 at 11:49 +0200, Roland Koebler wrote:

 Using custom stylesheets *does* work (although it still seems that
 ~/.gtk-3.0.css has no effect under Gnome3); but for some themes and
 Gnome3, setting background-color doesn't have any effect, but setting
 background seems to work.

A reminder for people reading this in the mail archive months from
now ;-)

Don't forget to test with both a dark-on-light and a light-on-dark user
theme, and, as with CSS, remember to set the text colour when you change
the background...

Liam


-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org freenode/#xml

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list