Development/Tutorials/Plasma4/Theme: Difference between revisions

From KDE TechBase
(New Plasma Theming Tutorial for Non-Programmers)
 
mNo edit summary
 
(13 intermediate revisions by 7 users not shown)
Line 1: Line 1:
A feature of Plasma is the ability to theme desktop elements using '''Scalable Vector Graphics (SVGs)'''.  This means there is no need for theme authors to know C++ or any other programming language to create a great looking theme.  They need only use common graphics tools many are already familiar with (e.g. Krita, Inkscape, The GIMP, Karbon, etc.).  Depending on your prowess with such tools, a great looking plasma theme can be created in under an hour.  
A feature of Plasma is the ability to theme desktop elements using '''Scalable Vector Graphics (SVGs)'''.  This means there is no need for theme authors to know C++ or any other programming language to create a great looking theme.  They need only use common graphics tools many are already familiar with (e.g. Krita, Inkscape, The GIMP, Karbon, etc.).  Depending on your prowess with such tools, a great looking plasma theme can be created in under an hour.  


==Creating the Theme in 7 Easy Steps==
See also [[Development/Tutorials/Plasma5/ThemeDetails|Plasma Theme Details]].
# Copy an existing plasma theme folder to a new folder with the new theme name.  Installed themes are stored in ''share/apps/desktoptheme/'' in either your .kde directory or your kde installation directory. You can also find Plasma themes on [http://kde-look.org KDE-Look]. Edit the .desktop file in the theme folder to match your theme name. See [[Projects/Plasma/Theme#Theme_Storage|Theme Storage]] if you need help.
 
# Open the SVG file associated with the plasma element you would like to theme (panel background, clock, etc.) in an SVG editor (e.g. Inkscape, Karbon).  See [[Projects/Plasma/Theme#Current_Theme_Elements|Current Theme Elements]] if you need help understand what each element does.  ''Note that some theme elements - '''tasks.svg''' - require KDE 4.1 or an svn version of KDE.''
==Creating a Plasma Theme in 7 Easy Steps==
# Each SVG file may have several elements (e.g. objects with element id = left, right, top, topright, center, clock face, etc.). If the SVG file you chose does, you can modify the old element or delete and create a replacement element.  Elements can be any svg object or object group.  '''''Hint''': You can embed raster images as svg elements if you creatively prefer raster editors like Krita, the GIMP, etc. Remember to '''embed''', instead of link, each image.''
# Copy and rename an existing plasma theme folder.  The new folder name can be the name of the theme.  Installed themes are stored in ''share/apps/desktoptheme/'' in either your .kde directory or your kde installation directory. You can also find Plasma themes on [http://kde-look.org KDE-Look]. Edit the '''metadata.desktop''' file in the theme folder to match your theme name. See [[Projects/Plasma/Theme#Theme_Storage|Theme Storage]] if you need help.
# Open the SVG file associated with the plasma element you would like to theme (panel background, clock, etc.) in an SVG editor (e.g. Inkscape, Karbon).  See [[Projects/Plasma/Theme#Current_Theme_Elements|Current Theme Elements]] if you need help understand what each SVG file does.   
# Each SVG file may have several elements (e.g. objects with element id = left, right, top, topright, center, clock face, etc.). Modify existing elements OR delete and create replacement elements.  Elements can be any SVG primitive or object group.  '''''Hint''': You can embed raster images as SVG elements if you creatively prefer raster editors like Krita, the GIMP, etc. '''Remember to embed, instead of link, each image (inkscape: effects->images->embed all images)'''.''
# To make renaming of the theme elements easier is possible to use an Inkscape extension located at [http://websvn.kde.org/trunk/playground/artwork/Oxygen/notmart/inkscapeextensions/ this address]
# Check to make sure that the element id for each new element is correctly set. '''''Hint''': In Inkscape you can check the element id for each object by right-clicking on the object and choosing Object Properties.''
# Check to make sure that the element id for each new element is correctly set. '''''Hint''': In Inkscape you can check the element id for each object by right-clicking on the object and choosing Object Properties.''
# Add or remove any hint element you desire.  It doesn't matter how these look, just that they exist or don't exist. A description of [[Projects/Plasma/Theme#Background|hint elements] are provided. ''Note that some hint elements - '''hint-tile-center, hint-apply-color-scheme''' - require KDE 4.1 or an svn version of KDE.''
# Add or remove any hint element you desire.  It doesn't matter how these look, just that objects with the element ids matching the hint elements either exist or don't exist. See  [[Projects/Plasma/Theme#Backgrounds_format|Backgrounds format]] for a description of available hint elements.  
# Save the SVG file.
# Save the SVG file.
# Repeat steps 3 - 6 for any other plasma element for which you would like to create a new theme.
# Repeat steps 3 - 6 for any other plasma element for which you would like to create a new theme.
Line 12: Line 16:
==Testing the Theme==
==Testing the Theme==
* If you have not already done so, copy your new theme folder to the ''share/apps/desktoptheme'' directory in either your .kde folder or your kde install folder.  
* If you have not already done so, copy your new theme folder to the ''share/apps/desktoptheme'' directory in either your .kde folder or your kde install folder.  
* Choose the theme from the from the configure desktop dialog (may require kde restart) or edit your ''plasmarc'' file to point to the new theme.
* Choose the theme from the Configure Desktop dialog (may require kde restart) or edit your ''plasmarc'' file to point to the new theme.
* Carefully check the appearance of all new theme elements.
* Carefully check the appearance of all new theme elements.
* If you created separate non-composite themes (SVGs in the opaque folder), remember to test your theme with compositing (Desktop Effects) turned off.
* If you created separate non-composite themes (SVGs in the opaque folder), remember to test your theme with compositing (Desktop Effects) turned off.
Line 21: Line 25:


==Hints and Tips==
==Hints and Tips==
* Even a pixel or two out of place can make a difference over hours of use.  It may not be obvious at first glance but the user may intuitively pick up that something is just 'not right' and give up using your theme.
* Even '''a pixel or two out of place''' can make a difference over hours of use.  It may not be obvious at first glance but the user may intuitively pick up that something is just 'not right' and give up using your theme.
* In Inkscape, turn off stroke scaling when objects are resized.  Inkscape may default to scaling the stroke of an object when changing its size.  This may show up in the rendered plasma theme as thin, barely-there, lines you can't seem to get rid of.
* In Inkscape, '''turn off stroke scaling''' when objects are resized.  Inkscape may default to scaling the stroke of an object when changing its size.  This may show up in the rendered plasma theme as thin, barely-there, lines you can't seem to get rid of.
* If you prefer raster editors like Krita and GIMP, create your particular theme in these programs first then import them into Inkscape (drag and drop of the files works fine). If you're working on a background with multiple elements (e.g. panel-background, widget background, etc.) crop the raster image into the different elements (top, bottom, right, etc.) before importing into Inkscape.
* If you prefer raster editors like Krita and GIMP, create your particular theme in these programs first then import them into Inkscape (drag and drop of the files works fine). If you're working on a background with multiple elements (e.g. panel-background, widget background, etc.) crop the raster image into the different elements (top, bottom, right, etc.) and save as separate files before importing into Inkscape.
* Don't forget to '''embed''' imported raster images.  By default Inkscape will import these as linked images which will not show up in plasma.
* Don't forget to '''embed imported raster images'''.  By default Inkscape will import these as linked images which will not show up in plasma (to embed the images, go to '''Effects > Images > Embed All Images''').
* Remember the the border elements (top, right, bottom, left) are '''tiled''' if the ''hint-stretch-borders'' element is not present in the svg.
* Remember that border elements of backgrounds (top, right, bottom, left) are '''tiled''' if the ''hint-stretch-borders'' element is not present in the svg.
* Remember that the center element of backgrounds are '''stretched''' if the ''hint-tile center'' element is not present in the svg.  
* Remember that the center element of backgrounds are '''stretched''' if the ''hint-tile center'' element is not present in the svg.  
* To control how much colorization will be applied by plasma when using the ''hint-apply-color-scheme'' element, make sure the color (HSV) Value/Intensity is closer to 0 or 255 for less colorization, and closer to 127 for more colorization.  So, for example, to keep shadows from being colorized, use color (HSV) Value/Intesity of 0.
* To control how much colorization will be applied by plasma when using the ''hint-apply-color-scheme'' element, make sure the color (HSV) Value/Intensity is closer to 0 or 255 for less colorization, and closer to 127 for more colorization.  So, for example, to keep shadows from being colorized, use color (HSV) Value/Intesity of 0.
* When testing the theme.  If it looks like portions of a multi-element svg missing (missing borders, etc.) check the svg again to make sure the element ids are correct.
* When testing the theme, if it looks like portions of a multi-element SVG is missing (missing borders, etc.) check the svg again to '''make sure the element ids are correct'''.
* Do not use more advanced SVG features since they will not be rendered properly. If you want to add blur or something similar, consider pre-rendering to PNG, and then import the PNG into the final SVG file.
* Perform this quick sanity check for background SVGs to help troubleshoot annoying lines and gaps between elements:
* Perform this quick sanity check for background SVGs to help troubleshoot annoying lines and gaps between elements:
** ''topleft, top and topright'' elements should have the same height
** ''topleft, top and topright'' elements should have the same height

Latest revision as of 09:43, 5 March 2015

A feature of Plasma is the ability to theme desktop elements using Scalable Vector Graphics (SVGs). This means there is no need for theme authors to know C++ or any other programming language to create a great looking theme. They need only use common graphics tools many are already familiar with (e.g. Krita, Inkscape, The GIMP, Karbon, etc.). Depending on your prowess with such tools, a great looking plasma theme can be created in under an hour.

See also Plasma Theme Details.

Creating a Plasma Theme in 7 Easy Steps

  1. Copy and rename an existing plasma theme folder. The new folder name can be the name of the theme. Installed themes are stored in share/apps/desktoptheme/ in either your .kde directory or your kde installation directory. You can also find Plasma themes on KDE-Look. Edit the metadata.desktop file in the theme folder to match your theme name. See Theme Storage if you need help.
  2. Open the SVG file associated with the plasma element you would like to theme (panel background, clock, etc.) in an SVG editor (e.g. Inkscape, Karbon). See Current Theme Elements if you need help understand what each SVG file does.
  3. Each SVG file may have several elements (e.g. objects with element id = left, right, top, topright, center, clock face, etc.). Modify existing elements OR delete and create replacement elements. Elements can be any SVG primitive or object group. Hint: You can embed raster images as SVG elements if you creatively prefer raster editors like Krita, the GIMP, etc. Remember to embed, instead of link, each image (inkscape: effects->images->embed all images).
  4. To make renaming of the theme elements easier is possible to use an Inkscape extension located at this address
  5. Check to make sure that the element id for each new element is correctly set. Hint: In Inkscape you can check the element id for each object by right-clicking on the object and choosing Object Properties.
  6. Add or remove any hint element you desire. It doesn't matter how these look, just that objects with the element ids matching the hint elements either exist or don't exist. See Backgrounds format for a description of available hint elements.
  7. Save the SVG file.
  8. Repeat steps 3 - 6 for any other plasma element for which you would like to create a new theme.

Testing the Theme

  • If you have not already done so, copy your new theme folder to the share/apps/desktoptheme directory in either your .kde folder or your kde install folder.
  • Choose the theme from the Configure Desktop dialog (may require kde restart) or edit your plasmarc file to point to the new theme.
  • Carefully check the appearance of all new theme elements.
  • If you created separate non-composite themes (SVGs in the opaque folder), remember to test your theme with compositing (Desktop Effects) turned off.

Theme Colors

  • You can provide a plasma color scheme that will allow text, selected backgrounds and other items to blend well with your theme by supplying a colors file in your theme folder. See the colors file in the default theme for an example.
  • If the colors file is omitted, plasma will take on the current KDE system colors. Note: Theme SVGs will not be colorized unless they contain the 'hint-apply-color-scheme' element.)

Hints and Tips

  • Even a pixel or two out of place can make a difference over hours of use. It may not be obvious at first glance but the user may intuitively pick up that something is just 'not right' and give up using your theme.
  • In Inkscape, turn off stroke scaling when objects are resized. Inkscape may default to scaling the stroke of an object when changing its size. This may show up in the rendered plasma theme as thin, barely-there, lines you can't seem to get rid of.
  • If you prefer raster editors like Krita and GIMP, create your particular theme in these programs first then import them into Inkscape (drag and drop of the files works fine). If you're working on a background with multiple elements (e.g. panel-background, widget background, etc.) crop the raster image into the different elements (top, bottom, right, etc.) and save as separate files before importing into Inkscape.
  • Don't forget to embed imported raster images. By default Inkscape will import these as linked images which will not show up in plasma (to embed the images, go to Effects > Images > Embed All Images).
  • Remember that border elements of backgrounds (top, right, bottom, left) are tiled if the hint-stretch-borders element is not present in the svg.
  • Remember that the center element of backgrounds are stretched if the hint-tile center element is not present in the svg.
  • To control how much colorization will be applied by plasma when using the hint-apply-color-scheme element, make sure the color (HSV) Value/Intensity is closer to 0 or 255 for less colorization, and closer to 127 for more colorization. So, for example, to keep shadows from being colorized, use color (HSV) Value/Intesity of 0.
  • When testing the theme, if it looks like portions of a multi-element SVG is missing (missing borders, etc.) check the svg again to make sure the element ids are correct.
  • Do not use more advanced SVG features since they will not be rendered properly. If you want to add blur or something similar, consider pre-rendering to PNG, and then import the PNG into the final SVG file.
  • Perform this quick sanity check for background SVGs to help troubleshoot annoying lines and gaps between elements:
    • topleft, top and topright elements should have the same height
    • topright, right and bottomright elements should have the same width
    • bottomleft, bottom and bottomright elements should have the same height
    • topleft, left and bottomleft elements should have the same width