Nova Flow OS
KDE Developer Platform
KDE Developer Platform
  • KDE Developer Platform
    • Getting started
      • Building KDE software
        • KDE software
        • Where to find the development team
        • Learning more
        • Choose what to work on
        • Source code cross-referencing
        • Installing build dependencies
        • Set up a development environment
        • Building KDE software with kdesrc-build
        • Basic troubleshooting
        • Tips and tricks
        • IDE Configuration
          • Setting up an IDE for KDE development
          • Visual Studio Code
          • Qt Creator
          • Kate
          • KDevelop
          • CLion
          • Sublime Text
        • Building KDE software manually
        • Building KDE software with distrobox and podman
      • Kirigami
        • KDE is ours
        • Setting up and getting started
        • Explaining pages
        • Layouts, ListViews, and Cards
        • Adding actions
        • Adding a dialog
        • Using separate files
        • Next steps
        • Colors and themes in Kirigami
        • Typography
        • Actions based components
        • Page rows and page stacks
        • Scrollable pages and list views
        • Cards
        • Drawers
        • Chips
        • Dialog types
        • Controls and interactive elements
        • Form layouts
        • Inline messages
        • Action toolbars
        • Progress bars and indicators
        • List views
        • Understanding CMakeLists
        • Figuring out main.cpp
        • Connect logic to your QML user interface
        • Connect models to your QML user interface
        • About page
        • Introduction to Kirigami Addons
        • FormCard About pages
        • Form delegates in your settings pages
      • KXmlGui
        • Getting started with KXmlGui
        • Hello World!
        • Creating the main window
        • Using actions
        • Saving and loading
        • Command line interface
      • Python with Kirigami
        • Apps with QML and Python
        • Your first Python + Kirigami application
        • Creating a Python package
        • Creating a Flatpak
      • Common programming mistakes
      • Adding a new KDE project
    • Features
      • Icons
      • Configuration
        • The KConfig Framework
        • Introduction to KConfig
        • Using KConfig XT
        • KDE Frameworks 6 porting guide
        • Settings module (KCM) development
        • KConfigDialog
      • D-Bus
        • What is D-Bus practically useful for?
        • Introduction to D-Bus
        • Accessing D-Bus interfaces
        • Intermediate D-Bus
        • Creating D-Bus interfaces
        • Using custom types with D-Bus
        • D-Bus autostart services
      • Create your own mouse cursor theme
      • Session management
      • Archives
      • Desktop file
      • KAuth
        • Privilege Escalation
        • Using actions in your applications
      • KIdleTime
      • Akonadi: personal information management
        • Debugging Akonadi Resources
        • Using Akonadi in applications
      • Concurrent programming
      • Solid
      • Sonnet
    • Plasma themes and plugins
      • Getting started
      • Plasma Widget tutorial
        • How to create a plasmoid
        • Setup
        • Porting Plasmoids to KF6
        • Testing
        • QML
        • Plasma's QML API
        • Widget Properties
        • Configuration
        • Translations / i18n
        • Examples
        • C++ API
      • KWin Effects
      • Plasma Desktop scripting
        • Javascript Interaction With Plasma Shells
        • Templates
        • Examples
        • API documentation
        • Configuration keys
      • Plasma Style tutorial
        • Creating a Plasma Style quickstart
        • Understanding Plasma Styles
        • SVG elements and Inkscape
        • Background SVG format
        • System and accent colors
        • Theme elements reference
        • Porting themes to Plasma 5
        • Porting themes to Plasma 6
      • Aurorae window decorations
      • KWin scripting tutorial
        • Quick start
        • KWin scripting API
      • Wallpapers
      • Plasma comic
        • Tutorial
        • Testing and debugging
        • Examples
      • Create a custom Window Switcher
      • KRunner C++ Plugin
        • Basic Anatomy of a Runner
        • KRunner metadata format
    • Applications
      • Creating sensor faces
      • Dolphin
        • Creating Dolphin service menus
      • Kate
        • Kate plugin tutorial
      • KMines
        • Making a KMines theme
      • Writing tests
        • Appium automation testing
    • Packaging
      • Android
        • KDE on Android
        • Building applications for Android
        • Packaging and publishing applications for Android
        • Publishing on Google Play
          • Introduction
          • Packaging your app
          • Adding your app to Google Play
          • Publishing your app
          • Releasing new versions of old apps
        • Porting applications to Android
          • Basic porting
          • Making applications run well on Android
          • Metadata
      • Windows
        • Packaging and publishing applications for Windows
        • Publish your app in the Microsoft Store
          • Packaging your app for the Microsoft Store
          • Submitting your app to the Microsoft Store
      • Plasma Mobile
        • KDE on mobile devices
        • Porting a new device to Plasma Mobile
        • KDE Telephony stack
          • General Overview
          • Kernel layer
          • System daemons
            • General overview
            • Developing Telephony functionality
            • ModemManager Telephony functions
          • Session daemons
          • QML declarative plugin layer
          • KDE application layer
        • Execute applications
      • Distributing KDE software as Flatpak
        • Your first Flatpak
        • Extending your package
        • Nightly Flatpaks and Flathub
        • Testing your Flatpak
    • System administration
      • Shell scripting with KDE dialogs
      • Kiosk: Simple configuration management for large deployment
        • Abstract
        • Introduction to Kiosk
        • Kiosk keys
    • Contribute to the documentation
    • About
      • Readme
      • License
        • Creative Commons Attribution-ShareAlike 4.0 International
        • GNU General Public License 3.0 or later
Powered by GitBook
On this page
  1. KDE Developer Platform
  2. Plasma themes and plugins
  3. Plasma Style tutorial

Background SVG format

Plasma's background SVG

PreviousSVG elements and InkscapeNextSystem and accent colors

Last updated 8 months ago

Many Plasma SVGs follow a common format for their background elements, either fully (like all background.svg versions) or partially, with modifications (like lineedit.svg, dragger.svg and glowbar.svg).

The element IDs for all SVG files are listed in the , including all SVG files that differ from the background SVG format, with a listing of elements according to their placement.

All background SVGs (except for wallpaper images) must have SVG elements that have the following element ID parts representing their position, all of which will be painted at the native size (and can therefore be bitmaps), except for center which will be scaled.

For brevity's sake, the many element ID parts available in the current Background SVG Format and in the are bundled together into semantic groups for easier reading using square brackets []:

  • [position]

    • [position] can be:

      • top: the top bar between the two top corners

      • topright: the top right corner

      • right: the right bar between the two right corners

      • bottomright: the bottom right corner

      • bottom: the bottom bar between the two bottom corners

      • bottomleft: the bottom left corner

      • left: the left bar between the two left corners

      • topleft: the top left corner

      • center: the center fill; it will be scaled, so it should be an actual SVG element

The set of nine elements with position IDs put together is called a frame. Frames are typically found in buttons or containments, the latter being the space where some additional content is stored, like panels, Plasma widgets or dialogs.

Some Plasma components may use the above named ID names with prefixes, as mentioned in Position and meaning of element IDs in Plasma SVG files. For example, if you inspect widgets/panel-background.svg, the panel placed on the left side of the screen uses the "west" prefix (west-topleft, west-topright, etc.). The cardinal directions available are north, east, south and west and they are further referenced as [cardinaldirection]:

  • [cardinaldirection]

    • [cardinaldirection] can be:

      • north

      • east

      • south

      • west

Cardinal directions are particularly useful, for instance, when combined with the center element ID to have panels with different colors depending on their position on the screen, among other special use cases like widgets/tabbar.svg.

Following this format, something like west-topleft can then be referenced as [cardinaldirection]-[position]. If we compare top, west-right and north-left, we would have something like:

CARDINALDIRECTION
POSITION
RESULT

top

top

west

right

west-right

north

center

north-center

So far, this works for plain backgrounds without shadows or background masks. To create those, you can use the shadow and mask prefixes to make frames that follow the same structure:

  • shadow-[position]: each element can use SVG effects like gradients and alpha channels to create shadows that will show up in your backgrounds

  • mask-[position]: all elements for the mask should be black

Shadows and background masks cannot use cardinal directions.

Additionally, elements with a few hint IDs can be used to control the rendering of the backgrounds:

  • [hint]

    • [hint] can be:

      • hint-stretch-borders: if it exists, the borders will not be tiled but rather stretched to fill the entire area

      • hint-tile-center: if it exists, the center will not be scaled but rather tiled to fit, that is, the pattern with this hint will be repeated until it fills the entire area (optional, from 4.1 and later).

      • hint-no-border-padding: if it exists, padding will not be added for the borders, and content will fill the entire area (including borders).

      • hint-apply-color-scheme: if it exists, the SVG will be colorized using the color scheme colors defined by the user. Colorization is applied at 100%, with tapered lines off on either side, and an HSV color value/intensity of 127.

      • hint-compose-over-border: if it exists, the center element will be drawn with the same size as the full image, composed under the borders and shaped with the alpha mask frame, which has to be present in order to make this hint work (optional).

  • hint-[direction]-shadow: hints used to determine the size of the shadow

    • [direction] can be:

      • top: the top edge of the frame; the hint's height will be used for this element

      • right: the right edge of the frame; the hint's width will be used for this element

      • bottom: the bottom edge of the frame; the hint's height will be used for this element

      • left: the left edge of the frame; the hint's height will be used for this element

  • [prefix]-hint-[direction]-margin: Use these optional hints if you want different margins than the border size in the SVG. height of these hints are used, for the left and right margins, the width.

    • [prefix] is optional and depends on the SVG frame. For example, mask or shadow. A few other Plasma SVGs use some modification of the prefix: lineedit uses state, frame uses3dlook, listitem uses typ.

    • [direction] is like the above.

Next there can optionally be another element with an ID overlay (or [prefix]-overlay if it applies to a frame with a different prefix). It will be rendered over the frame like a watermark, with the rules given from the following mutually exclusive hints:

  • hint-overlay-random-pos: it will be put at a random position, this works only for applet backgrounds

  • hint-overlay-tile: tile the overlay; in other words, repeat the same pattern in the entire overlay

  • hint-overlay-stretch: the overlay will be stretched

  • hint-overlay-pos-right: align the overlay to the right of the background rather than to the left

  • hint-overlay-pos-bottom: align the overlay at the bottom of the background rather than at the top

To summarize, here is a table of example element IDs used in backgrounds:

CARDINALDIRECTION
SHADOW/MASK
POSITION/HINT
RESULT

left

left

west

top

west-top

shadow

topright

shadow-topright

mask

bottom

mask-bottom

hint-stretch-borders

hint-stretch-borders

shadow

hint-top-margin

shadow-hint-top-margin

east

hint-bottom-margin

east-hint-bottom-margin

The last element ID is special and needs a section of its own:

current-color-scheme: if it exists, it is replaced by a CSS style with colors from the current color scheme. See for details.

Theme Elements Reference
Theme Elements Reference
System and Accent Colors