Ubuntu – Why do the GNOME symbolic icons appear darker in a running application

application-developmentgtkiconsthemes

I'm creating an application that uses symbolic icons from the default theme.

However, there are a few icons that I need that cannot be represented by those from the default theme, so I'm creating my own ones.

What I did was to simply go to /usr/share/icons/gnome/scalable/actions/, copied a few locally into my app's source tree that could serve as a basis, and started editing them.

So far so good. But I've noticed the following: all symbolic icons are of a light grey color when looking at the original .svg file, but when they are put onto a widget, they become darker.

Here's an example, using the /usr/share/icons/gnome/scalable/actions/view-refresh-symbolic.svg icon from the default theme:

  • Here's what it looks like when opening the original with Inkscape:

view-refresh-symbolic on Inkscape

  • And here's what it looks like on a toolbar on a running application:

view-refresh-symbolic on at runtime

Notice the icon being much darker at runtime. That happens both with the Ambiance and Radiance themes.

I wouldn't mind much, but I noticed it affects my custom icon, whereby parts of it become darker (the inner fill), whereas parts of it remain the same color as the original (the stroke).

So what causes the default symbolic icons to darken and how should implement that for my custom icons?

Best Answer

  • The symbolic icons are created in a chroma-keyed color, gray with full opacity (#bebebeff). They can then be colored based on the fg_color value defined by the theme in settings.ini (GTK3) or gtkrc (GTK2); or on the fg_color defined in the CSS (GTK3).
    • e.g., for Ambiance the foreground color (fg_color) is set to dark gray (#4c4c4c) in /usr/share/themes/Ambiance/gtk-3.0/settings.ini, which is why the symbolic icons appear darker.
  • To make custom symbolic icons look the same, you must remove the stroke and use only fill with the RGBA value set to #bebebeff; otherwise, the stroke will always appear as set (i.e., gray or whatever color).

    • In Inkscape, just select the object, open Fill and Stroke, and click on the No Paint (x) icon under "Stroke Paint":

    enter image description here

  • This gives us a nice and even-looking "MyRefresh" symbolic icon:

    enter image description here


One user indicated that a different, darker icon was being opened instead of the default gnome symbolic icon; as this strace shows, that assertion is incorrect:

enter image description here

Related Question