Saturday, January 11, 2014

Workaround for Highlighted Text Problems in GNOME Apps when Using Custom GTK Theme

A zonColor theme user reported: 'When i select any zoncolor theme i can't read text when i selected it in evince pdf reader'.


After some investigations, I found that this is a known bug of some GNOME apps like Evince, Evolution, and maybe other too (see https://bugzilla.gnome.org/show_bug.cgi?id=682435), so it will affects other GTK themes that do not include "new standard" in GTK theme color definition.

Those apps look for "the new standard" theme_selected_bg_color, theme_selected_fg_color, etc., instead of the standard, long time used "selected_bg_color", "selected_fg_color", etc (notice the difference, later ones are without "theme_"). This causing any theme that does not use "theme_*" color definitions in its css files will have problems with those apps.

For example, enable the Ambiance GTK theme (the default theme in Ubuntu) that does not using "theme_*" color definitions, and you will see the same problem in Evince.

.

Workaround


Put the following codes into /home/$USER/.config/gtk-3.0/gtk.css file (create one if it does not exist), or into the gtk.css file of the GTK theme you are using (for example into /home/$USER/.themes/zoncolor/gtk-3.0/gtk.css).

Put at the very end line of the file:

/*** CODES BEGIN ***/

@define-color theme_bg_color             @bg_color;
@define-color theme_fg_color             @fg_color;
@define-color theme_base_color           @base_color;
@define-color theme_text_color           @text_color;
@define-color theme_selected_bg_color    @selected_bg_color;
@define-color theme_selected_fg_color    @selected_fg_color;

.view:selected,
.view.selected:focused  {
color: @theme_selected_fg_color;
background-color: @theme_selected_bg_color;
}

/*** CODES END ***/

If you want, you can replace @selected_bg_color (for example) with fixed color code (like with #0088ff for example).

I'm not using those "theme_*" color definitions because it's simpler to use the standard one (without "theme_*") in zonColor GTK themes. But apparently, I have to use it in the next version. Oh well... :)

.


PS: Still, sorry for my English :)

No comments:

Post a Comment

Google+ Comments Disqus Comments
Disqus Comments Google+ Comments
comments powered by Disqus