Difference between revisions of "User:Pino/Handling icons"

Jump to: navigation, search
(first draft)
 
(small bits)
 
(One intermediate revision by one user not shown)
Line 11: Line 11:
  
 
Where:
 
Where:
* ''theme'': the two-letter name of the icon theme; for example:
+
* ''theme'': the two-letter name of the icon theme; supported themes are:
 
** <tt>hi</tt>: hicolor
 
** <tt>hi</tt>: hicolor
 
** <tt>ox</tt>: Oxygen
 
** <tt>ox</tt>: Oxygen
Line 23: Line 23:
 
=== Installing with CMake (KDE 4) ===
 
=== Installing with CMake (KDE 4) ===
  
To install icons with the CMake buildsystem using the KDE4 macros, you just need to use
+
To install icons with the CMake buildsystem using the KDE4 macros, you just need to use one macro:
 
<pre>kde4_install_icons(<installation directory>)</pre>
 
<pre>kde4_install_icons(<installation directory>)</pre>
This CMake macros takes '''all''' the icons with a "compact" naming in the current directory, and installs them in the <installation directory> specified. Hence, if you want to install some icons in one location and some in another, the only solution you have is to put the icons in different directories with ad-hoc <tt>kde4_install_icons()</tt> calls.
 
 
 
<installation directory> is usually
 
<installation directory> is usually
 
* <tt>${ICON_INSTALL_DIR}</tt>: installs the icons in the <tt>share/icons</tt> subdirectory of the installation prefix.
 
* <tt>${ICON_INSTALL_DIR}</tt>: installs the icons in the <tt>share/icons</tt> subdirectory of the installation prefix.
 
* <tt>${DATA_INSTALL_DIR}/''applicationname''/icons</tt>: locally for an application only (see also the section below)
 
* <tt>${DATA_INSTALL_DIR}/''applicationname''/icons</tt>: locally for an application only (see also the section below)
 +
 +
{{warning|This CMake macros takes '''all''' the icons with a "compact" naming in the current directory, and installs them in the <installation directory> specified. Hence, to install some icons in one location and some in another, the only solution is to put the icons in different directories with ad-hoc <tt>kde4_install_icons()</tt> calls.}}
  
 
== Choosing the right icon theme and installation directory ==
 
== Choosing the right icon theme and installation directory ==
Line 35: Line 35:
 
There are few things to keep into account when choosing which icon theme use for icons, and which directory install them into.
 
There are few things to keep into account when choosing which icon theme use for icons, and which directory install them into.
  
=== Own application icon ===
+
One thing to remember is that the <tt>hicolor</tt> icon theme (called ''fallback theme'') is the only common denimonator among all the possible icon themes.
  
When install the icon of your own application, you want to make it used by any other user, regarless of which icon theme they are using. Because of this:
+
=== Application icon ===
* use the <tt>hi</tt> (hicolor) icon theme, which is the only common denominator (called also ''fallback theme'') among any icon theme
+
 
 +
When install the application icon of an application (i.e. the icon representing the application, usually named after the application itself), you want to make it used by anyone, regardless of which icon theme they are using. Because of this:
 +
* use the <tt>hi</tt> (hicolor) icon theme
 
* use <tt>${ICON_INSTALL_DIR}</tt> as installation directory, as it allows the icon to be seen by all the other applications installed in the same prefix
 
* use <tt>${ICON_INSTALL_DIR}</tt> as installation directory, as it allows the icon to be seen by all the other applications installed in the same prefix
  
=== Other icons for own application ===
+
=== Simple application, other icons ===
 +
 
 +
This is the case for KDE applications with nothing like plugins for plugin systems not of the own application itself (like kparts, kioslaves, konqueror service menus, etc). In this case:
 +
* use the <tt>hi</tt> (hicolor) icon theme
 +
* use <tt>${DATA_INSTALL_DIR}/''applicationname''/icons</tt> as installation directory
  
TODO
+
Installing the icons in a ''icons'' subdirectory of the application data directory allows the application to make use of them without "polluting" the global icon theme with application-specific icons, but still making icon themes able to ''override'' the <tt>hicolor</tt> icons of the application with own icons.

Latest revision as of 00:56, 12 July 2011

noframe
 
Warning
This is not an official page.


noframe
 
Under Construction
This page is under construction. This page is actively being developed and updated with new information, and may be incomplete. You can help by editing this page


Contents

[edit] Installing

[edit] Compact naming

One of the most common ways to name icons in sources is a "compact" form which includes various details. The format is the following:

<theme><size>-<context>-<name>.<extension>

Where:

  • theme: the two-letter name of the icon theme; supported themes are:
    • hi: hicolor
    • ox: Oxygen
    • cr: Crystal SVG
    • lo: locolor
  • size: the size of the icon in pixels (e.g. 24 for a 24x24 icon), with the special value sc for scalable icons in SVG(Z) format
  • context: the context for the icon, as specified in either the XDG icon theme specification or the XDG icon naming specification; e.g. app for application icons, mime for MIME type icons, and so on
  • name: the real name of the icon
  • extension: the extension of the icon, e.g. png, svg, etc

[edit] Installing with CMake (KDE 4)

To install icons with the CMake buildsystem using the KDE4 macros, you just need to use one macro:

kde4_install_icons(<installation directory>)

<installation directory> is usually

  • ${ICON_INSTALL_DIR}: installs the icons in the share/icons subdirectory of the installation prefix.
  • ${DATA_INSTALL_DIR}/applicationname/icons: locally for an application only (see also the section below)
noframe
 
Warning
This CMake macros takes all the icons with a "compact" naming in the current directory, and installs them in the <installation directory> specified. Hence, to install some icons in one location and some in another, the only solution is to put the icons in different directories with ad-hoc kde4_install_icons() calls.


[edit] Choosing the right icon theme and installation directory

There are few things to keep into account when choosing which icon theme use for icons, and which directory install them into.

One thing to remember is that the hicolor icon theme (called fallback theme) is the only common denimonator among all the possible icon themes.

[edit] Application icon

When install the application icon of an application (i.e. the icon representing the application, usually named after the application itself), you want to make it used by anyone, regardless of which icon theme they are using. Because of this:

  • use the hi (hicolor) icon theme
  • use ${ICON_INSTALL_DIR} as installation directory, as it allows the icon to be seen by all the other applications installed in the same prefix

[edit] Simple application, other icons

This is the case for KDE applications with nothing like plugins for plugin systems not of the own application itself (like kparts, kioslaves, konqueror service menus, etc). In this case:

  • use the hi (hicolor) icon theme
  • use ${DATA_INSTALL_DIR}/applicationname/icons as installation directory

Installing the icons in a icons subdirectory of the application data directory allows the application to make use of them without "polluting" the global icon theme with application-specific icons, but still making icon themes able to override the hicolor icons of the application with own icons.


This page was last modified on 12 July 2011, at 00:56. This page has been accessed 1,504 times. Content is available under Creative Commons License SA 3.0 as well as the GNU Free Documentation License 1.2.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V.Legal