Difference between revisions of "Development/Tutorials/Plasma4/ThemeDetails"

Jump to: navigation, search
(Current Theme Elements)
(Current Theme Elements)
Line 22: Line 22:
  
 
== Current Theme Elements ==
 
== Current Theme Elements ==
*'''/background''': background images
+
 
**'''/dialog''': generic dialog background
+
Themes get installed to {{path|share/apps/desktoptheme}}. Each theme is stored in a subdirectory with the following file structure
**'''/widget''': generic desktop widget background
+
 
**'''/shutdowndlg''': shutdown dialog background
+
*'''/dialogs''': elements for dialogs
*'''/widget''': elements for desktop widgets
+
**'''/background.svg''': generic dialog background
**'''/colorball''': a colored ball
+
**'''/shutdowndlg.svg''': background for the log out dialog
**'''/header_background''': a background image with a header.
+
**'''/shutdowndlgbuttonglow.svg''': an overlay for buttons on the log out dialog that is shown on mouse over
***element ids: "header" is the area the header should be drawn into
+
*'''/widgets''': generic desktop widget background
 +
**'''/clock.svg''': an analog clock face. it must have the following named elements:
 +
*** ClockFace: the background of the clock, usually containing the numbers, etc
 +
*** HourHand: the hour hand, pointing down in the svg
 +
*** MinuteHand: the minute hand, pointing down in the svg
 +
*** SecondHand: the second hand, pointing down in the svg
 +
*** HandCenterScrew: the "pin" that holds the hands together in the center
 +
*** Glass: a final overlay which allows for things such as the appearance of glass
 +
** '''/iconbutton.svg''': backgrounds and overlays for icons that are clickable. can have any of the following named elements, each of which should be the same size:
 +
*** background: the default background, painted beneath the icon
 +
*** background-hover: background when the mouse hovers the icon
 +
*** background-pressed: background when the icon is pressed
 +
*** foreground: the default foreground, painted on top of the icon
 +
*** foreground-hover: foreground when the mouse hovers the icon
 +
*** foreground-pressed: foreground when the icon is pressed
 +
** '''/plot-background.svg''': a background for plotter (graph) widgets, such as the plots in ksysguard
 +
** '''/toolbox-button.svg''': the background for the desktop configuration toolbox button that sites at the edge of the desktop
 +
 
 +
The them itself is described by a .desktop file in {{path|share/apps/desktoptheme}}. The contents of which might look like this:
 +
 
 +
<code>
 +
[Desktop Entry]
 +
Name=Oxygen
 +
Comment=Theme done in the Oxygen style
 +
 
 +
X-KDE-PluginInfo-Author=The Oxygen Project
 +
 +
X-KDE-PluginInfo-Name=default
 +
X-KDE-PluginInfo-Version=pre0.1
 +
X-KDE-PluginInfo-Website=http://plasma.kde.org
 +
X-KDE-PluginInfo-Category=
 +
X-KDE-PluginInfo-Depends=
 +
X-KDE-PluginInfo-License=GPL
 +
X-KDE-PluginInfo-EnabledByDefault=true
 +
</code>
 +
 
 +
The X-KDE-PluginInfo-Name entry must contain the name of the subdirectory in {{path|share/apps/desktoptheme}} where the SVG files for this theme exist.

Revision as of 17:44, 2 June 2007

libplasma provides the Theme class so Plasma elements and other applications, such as KRunner, that need to graphically hint or theme interface elements. This is not a replacement for QStyle, but rather provides standard elements for things such as box backgrounds.

This allows for easy re-theming of the desktop while also keeping elements on the desktop more consistent with each other.

See also Plasma widgets.

Theme Storage

Still being finalized

Image Access

Theme elements are accessed by path. Whether this maps to literal paths on disk or not is not guaranteed and considered an implementation detail of Plasma::Theme.

Therefore, to access the dialog background, one might create an svg in this manner:

Plasma::Theme theme; QSvgRenderer svg( theme.image( "dialog/background" ); );

Reaction to Theme Changes

Still being finalized

Current Theme Elements

Themes get installed to share/apps/desktoptheme. Each theme is stored in a subdirectory with the following file structure

  • /dialogs: elements for dialogs
    • /background.svg: generic dialog background
    • /shutdowndlg.svg: background for the log out dialog
    • /shutdowndlgbuttonglow.svg: an overlay for buttons on the log out dialog that is shown on mouse over
  • /widgets: generic desktop widget background
    • /clock.svg: an analog clock face. it must have the following named elements:
      • ClockFace: the background of the clock, usually containing the numbers, etc
      • HourHand: the hour hand, pointing down in the svg
      • MinuteHand: the minute hand, pointing down in the svg
      • SecondHand: the second hand, pointing down in the svg
      • HandCenterScrew: the "pin" that holds the hands together in the center
      • Glass: a final overlay which allows for things such as the appearance of glass
    • /iconbutton.svg: backgrounds and overlays for icons that are clickable. can have any of the following named elements, each of which should be the same size:
      • background: the default background, painted beneath the icon
      • background-hover: background when the mouse hovers the icon
      • background-pressed: background when the icon is pressed
      • foreground: the default foreground, painted on top of the icon
      • foreground-hover: foreground when the mouse hovers the icon
      • foreground-pressed: foreground when the icon is pressed
    • /plot-background.svg: a background for plotter (graph) widgets, such as the plots in ksysguard
    • /toolbox-button.svg: the background for the desktop configuration toolbox button that sites at the edge of the desktop

The them itself is described by a .desktop file in share/apps/desktoptheme. The contents of which might look like this:

[Desktop Entry] Name=Oxygen Comment=Theme done in the Oxygen style

X-KDE-PluginInfo-Author=The Oxygen Project [email protected] X-KDE-PluginInfo-Name=default X-KDE-PluginInfo-Version=pre0.1 X-KDE-PluginInfo-Website=http://plasma.kde.org X-KDE-PluginInfo-Category= X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=true

The X-KDE-PluginInfo-Name entry must contain the name of the subdirectory in share/apps/desktoptheme where the SVG files for this theme exist.


Content is available under Creative Commons License SA 4.0 unless otherwise noted.