29 December 2006

GTK theme colors support

Today I added GTK theme colors support to the 1.3.x code in SVN (update: now merged with stable 1.2.3). Now Liferea adapts the HTML rendering to your GTK theme settings. Here is a screenshot when running with a pretty standard ClearLooks theme:



While the same display in some dark theme looks like this:



Of course depending on your themes contrast settings and base color some elements like the blue links in the above screenshots do hurt the eye, but this is something that is hard to avoid. Despite this I think this improvement helps to blend in more with other applications in your GTK/GNOME desktop. Depending on the used theme the old default gray header styles used until now could look "cold" or out of place.

If you have significant problems with the new rendering please send a screenshot of the problem and if possible a link to the theme definition online or at least the name of the theme to the mailing list or post a new item in the bug tracker at SF.

8 comments:

Anonymous said...

Nice!
Thanks for the 1.2 Release by the way!

Barbara said...

Rab achameno, tompergi odiz outron querolan!!! Quetim, hojudo kintenta havo, zantaraz auttou huma... Que rentesso ficuri fic guei pas ella, kinall diconsciar haiu. Gionia um, irr wolontatoa, compondarl quardi combrige quenon yoglivresfoi bentes!

Holger said...

Wow you rock. Up to now I had to adjust the css files manually. I'm going to grab the svn version at once.

Lars said...

You don't even need to use SVN. I've merged the code against stable with 1.2.3.

Holger said...

Too late, already running the svn version and I really like what I see.

But I'm not sure what you mean with "blue links fit better into the GNOME/Gtk Environment". There are already methods to set link color in gtk-themes and some apps use it, e.g. Evolution.
GtkWidget::link_color, GtkWidget::visited-link-color and
GtkHTML::link-color

I use a dark theme and the bright blue is really hurting the eyes. :) Also think about people using the accessibility HighContrastInverse theme. It has a blue background.

Lars said...

@Holger: Ok, if SVN trunk works for you (currently its pretty stable).

What I meant with the link color is that I know of no way to determine the GTK/GNOME theme link color to supply it to Gecko. And therefore the code does not modify the link color at all.

If you have any idea how retrieve the link color with some C-API...

Holger said...

Something like this should work.
----------------------
GdkColor *color;
gchar *linkColor;

gtk_widget_style_get (GTK_WIDGET(mainwindow), "link-color", &color, NULL);

linkColor = g_strdup_printf("#%.2x%.2x%.2x",
lc->red >> 8,
lc->green >> 8,
lc->blue >> 8);

mozsupport_preference_set("browser.anchor_color", linkColor);
g_free(linkColor);
----------------------
Note: "Should" like in "crashes when no link-color is set in the .gtkrc-2.0, but works if it is set" :)

Lars said...

@Holger: Thanks for the code piece! I wrote something that does compile but it says that the requested property does not exist. I checked the GTK+ changelog and found that the link colors are introduced with 2.10. I'm running Debian Unstable now with 2.8 therefore I cannot test it and would like to wait until Debian upgrades before I really introduce the code.