Jamboarder (Talk | contribs) (→Backgrounds format) |
Jamboarder (Talk | contribs) (→Current Theme Elements) |
||
Line 82: | Line 82: | ||
*'''/dialogs''': elements for dialogs | *'''/dialogs''': elements for dialogs | ||
− | **'''/background.svg''': generic dialog background | + | **'''/background.svg''': generic dialog background used by the sceensaver password dialog, etc. See the section on backgrounds above for information on the required elements in this file. |
− | **'''/ | + | **'''/krunner.svg''': dialog background, used by the Run Command. See the section on backgrounds above for information on the required elements in this file. |
− | **'''/ | + | **'''/shutdowndlg.svg''': background and buttons for the log out dialog |
+ | ***''background: background for the logout dialog | ||
+ | ***''button-normal: button background | ||
+ | ***''button-hover: button background on cursor hover | ||
+ | ***''button-small-normal: small button background | ||
+ | ***''button-small-hover: small button background on cursor hover | ||
*'''/widgets''': generic desktop widget background | *'''/widgets''': generic desktop widget background | ||
**'''/background.svg''': a background image for plasmoids. See the section on backgrounds above for information on the required elements in this file. | **'''/background.svg''': a background image for plasmoids. See the section on backgrounds above for information on the required elements in this file. | ||
Line 107: | Line 112: | ||
*** selection-rect: displayed when the icon is selected | *** selection-rect: displayed when the icon is selected | ||
**'''/panel-background.svg''': the default background image for panels. See the section on backgrounds above for information on the required elements in this file. | **'''/panel-background.svg''': the default background image for panels. See the section on backgrounds above for information on the required elements in this file. | ||
− | *** If you want to create different | + | *** If you want to create different background for panels located at the top, bottom, left or right, then also create sets of background elements with the following prefixes: ''north'', ''south'', ''west'' and ''east'' respectively. For example the center element of the left positioned panel's background should be named ''west-center''. (KDE 4.1 and later) |
** '''/plot-background.svg''': a background for plotter (graph) widgets, such as the plots in ksysguard | ** '''/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 | ** '''/toolbox-button.svg''': the background for the desktop configuration toolbox button that sites at the edge of the desktop | ||
− | **'''/tasks.svg''': task item backgrounds for tasks ( | + | **'''/tasks.svg''': task item backgrounds for tasks (KDE 4.1 and later). See the section on backgrounds above for information on the required elements in this file. The following element prefixes are required: |
*** ''focus'': background of focused task item | *** ''focus'': background of focused task item | ||
*** ''hover'': background when the pointer hovers the task item | *** ''hover'': background when the pointer hovers the task item | ||
*** ''attention'': background when tasks item is trying to get attention | *** ''attention'': background when tasks item is trying to get attention | ||
*** ''normal'': background of normal, unfocused task item | *** ''normal'': background of normal, unfocused task item | ||
− | *** | + | *** The svg must contain elements of all four prefixes, if a prefix is missing that element will be not be drawn. |
− | ** '''/systemtray.svg''': a background for the system tray. it does not have prefixes ( | + | ** '''/systemtray.svg''': a background for the system tray. it does not have prefixes (KDE 4.1 and later). See the section on backgrounds above for information on the required elements in this file. |
− | ** '''/containment-controls.svg''': handles for the | + | ** '''/containment-controls.svg''': handles for the control used to resize the panel (KDE 4.1 and later). The following elements are required. |
− | *** '' | + | *** ''maxslider'' maximum size slider, south position |
− | *** '' | + | *** ''minslider'' minimum size slider, south position |
− | *** '' | + | *** ''offsetslider'' positioning slider, south position |
− | *** | + | *** Each of the above elements must be present with ''north'', ''south'', ''east'' and ''west'' prefixes for each panel position. |
− | *** | + | *** There are also four backgrounds (north, south, east and west orientations) for the ruler widget itself in the "Backgrounds format", since the width of the widget is 100% the elements of left and right (or north and bottom if vertical) are not needed |
=="Opaque" folder== | =="Opaque" folder== |
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.
See also Creating a Plasma Theme.
Themes are stored in share/apps/desktoptheme. A theme 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 X-KDE-PluginInfo-Email=kde-artists@kde.org 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.
Beneath this directory one will find the following file structure:
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"));
It is generally recommended to use Plasma::Svg instead of QSvgRenderer directly, however. Remember to call resize() on the Plasma::Svg before painting with it!
Plasma::Svg svg("dialog/background");
svg.resize(size());
If you use Plasma::Svg, changes to the theme are automatically picked up. Otherwise, you can connect to the changed() signal in the Plasma::Theme class. This signal is emitted whenever the theme is changed, which may be triggered by the user switching the theme used or system changes such as a composite manager becoming available.
All background svg's (except for desktop wallpapers) must have the following named elements, all of which will be painted at the native size (and can therefore be bitmaps), except for the center which will be scaled:
Some plasma components may use the above named elements with prefixes. For example the panel placed on the left side of the screen uses the "west" prefix (west-topleft, west-topright, etc.).
Additionally, the following elements can be used to control the rendering of the backgrounds:
Themes get installed to share/apps/desktoptheme. Each theme is stored in a subdirectory with the following file structure
In the folder share/apps/desktoptheme/opaque the same hierarchy can be found: when compositing is disabled files in this folder are preferred over the corresponding ones listed above. Only background for top level windows are appropriate to go in this folder.
Since top-level windows will be shaped according to the transparency of the svg and window shapes don't support alpha-blending, if the svg has rounded borders they should have a shape that don't require antialiasing, like the following example.