Could someone please explain, why many programs have their icons’ paths this way:
/usr/share/program/icons/hicolor/16×16/…
What I don’t understand is why hicolor and why 16×16, 32×32 etc.
Are there any functions (e.g. in GTK) that automatically get the proper icon from such kind of paths?
Thank you!
Those icon paths are standardized by the Icon Theme Specification. The reasoning is that all applications can install their default icons into the
hicolortheme (which is the default theme, meaning that if an icon is missing from another theme, the version fromhicolorwill be used.)Also, a program can request an icon size that is different from the ones provided, say 37×37, and the system will select the most appropriate available size (like
32x32) and scale it to the requested size.If someone wants to override the application’s icon, for example to make a high-contrast black-and-white version for users with poor eyesight, then all they have to do is to make an icon with the same name and put it in the high-contrast black-and-white theme, and it will override the
hicoloricon.The functions you ask about also exist. In GTK there are functions that take a
const gchar *icon_nameparameter, such asgtk_image_new_from_icon_name(). These will load the icon with the name you supply from the current theme, and if it doesn’t exist in the current theme, then from thehicolortheme.