Creating Icon themes for GNOME

GNOME 2.2 and beyond features great integrated theme capabilities both for the file and device type icons such as those used by Nautilus, and application icons such as those used in the GNOME menu and many other GNOME apps as well. This tutorial will try to explain how the GNOME icon theming works (as based on the icon theme specification and icon naming specification from freedesktop.org) and how you can make icon themes for your favorite desktop.

Understanding the GNOME Icon theme engine

GNOME2 keeps icons for system-wide and user themes in separate directories. For system-wide themes the icons are stored in either /usr/share/icons or /usr/local/share/icons and icons for user themes are stored in /.icons. These all contain a sub-directory for each theme installed on your computer. Inside each themes' directory is a description file named index.theme which contains the theme name, icon types, default sizes and so forth. The icons themselves and .icon files are also contained in the theme directory, categorized into sub-folders by size and type [, such as emblems & filesystems.]

Maybe need another paragraph here, or better flow from the first paragraph to this one..

GNOME2 icons should be created using one of the following formats:

  • PNG
  • SVG
  • XPM

PNG is recommended for bitmap icons and SVG is recommended for vector icons. The XPM format is provided for legacy support, including themes supported by older GNOME1/Nautilus1 systems. There is no need to provide multiple sized versions of icons in the SVG format because they can be scaled to any size neccesary with no loss of quality. However, scaling and displaying SVG icons is more CPU intensive so older or slower machines might have problems running GNOME2 using themes that provide only SVG icons. For this reason, it is good practice to provide PNG versions of your icons as well as SVG.

Need another paragraph here, perhaps describing general things to do to prepare to make a new theme.. I suggest starting with another theme when creating a new theme and then replace the icons one by one. Creating a directory with the same name as your planned theme and creating the index.theme inside it is all that is needed to make the theme available in the Gnome theme manager.

Step 1. Creating an index.theme configuration file

To begin making your theme, create a folder of the same name as you wish to call your theme, or by copying another theme as suggested above, and then you will be ready to start setting up the theme.

The most important aspect of the icon theme is index.theme, an ini style configuration file which describes the theme in various sections. The main and most important section is broken down as follows:

This whole bit needs to be put into a user friendly, easily readable layout... ideas anyone? I accept/prefer actual code as a valid suggestion.

[IconTheme]
This section describes the layout of the theme in a very simple fairly intuitive way

Name = ThemeName
this field represents the name of the theme as should be displayed in the icons section of the Gnome Theme Manager, it is very important that the themes folder name matches this field

Comment = This is the theme comment
this field represents the comment of the theme as is sometimes displayed in Gnome Theme Manager

Directories = iconsize1/iconcategory1, iconsize1/iconcategory2, iconsize2/iconcategory1
this field represents the directories which contain the actual icons

Inherits = RootTheme
this field represents the root theme from which this theme inherits. If the theme does not supply a particular icon, GNOME will look in this root theme for icons before falling back on the system defaults.

Each directory as listed in the IconTheme section will also need its own section to describe icon size and type :

[Directory]
this section describes the characteristics of the icons located in this directory

Size = IconSize
this field represents the size of the icons located in this directory if they are bitmap icons (PNG or XPM), or the default scale if they are scalable icons (aka SVG)

MinSize = IconSize
this field represents the mimimum size that scalable icons (SVG) located in this directory can be scaled to.

MaxSize = IconSize
this field represents the maximum size that scalable icons (SVG) located in this directory can be scaled to.

Threshold = SizeThreshold==
this field represents the maximum size threshold that bitmap icons (PNG/XPM) located in this directory be used for if the icon type is Threshold.

Context = IconCategory
this field represents the category or context in which these icons are used. This value can be FileSystems (for Folder or HardDrives), Emblems, Applications, Devices, or MimeTypes

Type = IconType
this field represents the type of icons located in this directory, it can be Scalable for Scalable Icons (SVG), Threshold or Fixed(I have seen Scaled used as well, is this valid?!) for Bitmap Icons(PNG or XPM)

See the HighContrastTheme index.theme file as an example.

Step 2. General Directory and Icon Layout

Once you have a basic index.theme, the next step is to make the actual icon directories, and place the right icons in the right directories. First off, it should made apparent that the Directory entries you put in Index.theme are the actual names of the directories, so if you have a 48x48/filesystems section in the index.theme, you should have a corresponding folder 48x48/filesystems, and so forth. So, for the above example your should have a directory layout something like this:

HighContrastLargePrint/
        48x48/
                actions/
                apps/
                devices/
                mimetypes/
        scalable/
                actions/
                apps/
                devices/
                mimetypes/
        index.theme

As you can see the actual directory layout is the same layout as is described in the index.theme, making both updating the directory to match the index, or the index to match the layout very very easy.

Once you have created the directories you need, you need to organize the icons first by size and then by context, again exactly as is laid out in the index. So any 48x48 icons will go somewhere into the 48x48/ subdirectory tree by context.

Step 3. Icon naming & organization

In general icons are simply and intuitively named. You do not need to replace all the icons for your theme. In this case the absent icons will be taken form RootTheme specified in Inherits = RootTheme option in the index.theme file. The specific breakdown of the icons by context is as follows :

Filesystem

The FileSystem context is for icons intended to be used by a FileManager, such as Nautilus, to represent the core parts of a directory tree, essentially such icons as would be used to represent Folders, Network Servers, Network workstations, Fifo's, Character Devices, Executables and so forth.

For this context, every theme should probably have an icon representing

Name

Description

folder

The standard folder icon used to represent directories on local filesystems, mail folders, and other hierarchical groups.

folder-remote

The icon used for normal directories on a remote filesystem.

network-server

The icon used for individual host machines under the “Network Servers” place in the file manager.

network-workgroup

The icon for the “Network Servers” place in the desktop's file manager, and workgroups within the network.

start-here

The icon used by the desktop's main menu for accessing places, applications, and other features.

user-bookmarks

The icon for the user's special “Bookmarks” place.

user-desktop

The icon for the special “Desktop” directory of the user.

user-home

The icon for the special “Home” directory of the user.

user-trash

The icon for the user's “Trash” place in the desktop's file manager.

Devices

The Device context is for icons intended to be used to represent commonly used devices, such as CDROM, DVD, Floppy etc, from within a Desktop Manager, and/or a FileManager to diplay mounted hardware devices. These icons will usually have a context prefix of 'dev-'(i.e. cdrom = gnome-dev-cdrom).

For this context, every theme should probably have an icon representing

Name

Description

audio-card

The icon used for the audio rendering device.

audio-input-microphone

The icon used for the microphone audio input device.

battery

The icon used for the system battery device.

camera-photo

The icon used for a digital still camera devices.

camera-video

The fallback icon for video cameras.

camera-web

The fallback icon for web cameras.

computer

The icon used for the computing device as a whole.

drive-harddisk

The icon used for hard disk drives.

drive-optical

The icon used for optical media drives such as CD and DVD.

drive-removable-media

The icon used for removable media drives.

input-gaming

The icon used for the gaming input device.

input-keyboard

The icon used for the keyboard input device.

input-mouse

The icon used for the mousing input device.

input-tablet

The icon used for graphics tablet input devices.

media-flash

The fallback icon used for flash media, such as memory stick and SD.

media-floppy

The icon used for physical floppy disk media.

media-optical

The icon used for physical optical media such as CD and DVD.

media-tape

The icon used for generic physical tape media.

modem

The icon used for modem devices.

multimedia-player

The icon used for generic multimedia playing devices.

network-wired

The icon used for wired network connections.

network-wireless

The icon used for wireless network connections.

pda

This is the fallback icon for Personal Digial Assistant devices. Primary use of this icon is for PDA devices connected to the PC. Connection medium is not an important aspect of the icon. The metaphor for this fallback icon should be a generic PDA device icon.

phone

This is the default fallback for phone devices. Primary use of this icon group is for phone devices which support connectivity to the PC. These may be VoIP, cellular, or possibly landline phones. The metaphor for this fallback should be a generic mobile phone device.

printer

The icon used for a printer device.

scanner

The icon used for a scanner device.

video-display

The icon used for the monitor that video gets displayed to.

MimeTypes

Icons for MimeTypes such as msword, html or pdf will go into the mimetypes folder, the folder in the index matching the Size = 48, and Context = MimeTypes. In the case of this example the mimetypes folder is "mimetypes".

More specifically here are a handful of the 120 standard icons such as are set by the default Gnome icon theme :

Name

Description

application-x-executable

The icon used for executable file types.

audio-x-generic

The icon used for generic audio file types.

font-x-generic

The icon used for generic font file types.

image-x-generic

The icon used for generic image file types.

package-x-generic

The icon used for generic package file types.

text-html

The icon used for HTML text file types.

text-x-generic

The icon used for generic text file types.

text-x-generic-template

The icon used for generic text templates.

text-x-script

The icon used for script file types, such as shell scripts.

video-x-generic

The icon used for generic video file types.

x-office-address-book

The icon used for generic address book file types.

x-office-calendar

The icon used for generic calendar file types.

x-office-document

The icon used for generic document and letter file types.

x-office-presentation

The icon used for generic presentation file types.

x-office-spreadsheet

The icon used for generic spreadsheet file types.

Applications

Application icons, usually for GNOME specific applications such as gnome-calc, will go into the applications folder, the folder in the index matching the Size = 48, and Context = Applications. In the case of this example the applications folder is "apps".

Here are those standard icons such as are set by the default Gnome icon theme :

Name

Description

accessories-calculator

The icon used for the desktop's calculator accessory program.

accessories-character-map

The icon used for the desktop's international and extended text character accessory program.

accessories-dictionary

The icon used for the desktop's dictionary accessory program.

accessories-text-editor

The icon used for the desktop's text editing accessory program.

help-browser

The icon used for the desktop's help browsing application.

multimedia-volume-control

The icon used for the desktop's hardware volume control application.

preferences-desktop-accessibility

The icon used for the desktop's accessibility preferences.

preferences-desktop-font

The icon used for the desktop's font preferences.

preferences-desktop-keyboard

The icon used for the desktop's keyboard preferences.

preferences-desktop-locale

The icon used for the desktop's locale preferences.

preferences-desktop-multimedia

The icon used for the desktop's multimedia preferences.

preferences-desktop-screensaver

The icon used for the desktop's screen saving preferences.

preferences-desktop-theme

The icon used for the desktop's theme preferences.

preferences-desktop-wallpaper

The icon used for the desktop's wallpaper preferences.

system-file-manager

The icon used for the desktop's file management application.

system-software-install

The icon used for the desktop's software installer application.

system-software-update

The icon used for the desktop's software updating application.

utilities-system-monitor

The icon used for the desktop's system resource monitor application.

utilities-terminal

The icon used for the desktop's terminal emulation application.

Emblems

Emblems are the little icons that can be added to the standard (big) icon :

Name

Description

emblem-default

The icon used as an emblem to specify the default selection of a printer for example.

emblem-documents

The icon used as an emblem for the directory where a user's documents are stored.

emblem-downloads

The icon used as an emblem for the directory where a user's downloads from the Internet are stored.

emblem-favorite

The icon used as an emblem for files and directories that the user marks as favorites.

emblem-important

The icon used as an emblem for files and directories that are marked as important by the user.

emblem-mail

The icon used as an emblem to specify the directory where the user's electronic mail is stored.

emblem-photos

The icon used as an emblem to specify the directory where the user stores photographs.

emblem-readonly

The icon used as an emblem for files and directories which can not be written to by the user.

emblem-shared

The icon used as an emblem for files and directories that are shared to other users.

emblem-symbolic-link

The icon used as an emblem for files and directories that are links to other files or directories on the filesystem.

emblem-synchronized

The icon used as an emblem for files or directories that are configured to be synchronized to another device.

emblem-system

The icon used as an emblem for directories that contain system libraries, settings, and data.

emblem-unreadable

The icon used as an emblem for files and directories that are inaccessible.

Stock Icons

As of GTK2.4, stock icons (the icons used in toolbar buttons, menu items, and other widgets) can be defined in the icon theme.

No previous chapter

Back to Tutorial start page

Next chapter: Gtk+ Themes

Attic/GnomeArt/Tutorials/IconThemes (last edited 2013-11-27 14:33:57 by WilliamJonMcCann)