Custom color scheme for KDE/Plasma

Facebooktwittergoogle_plusredditpinterestlinkedinmail
Customizing the KDE/Plasma color scheme can be stricky

Customizing the KDE/Plasma color scheme can be stricky

Sometimes I wish to create a custom color scheme, but not all the colors were used. For example widgets (like application starter and task bars) do not use the custom color scheme. Here are some solutions that may help:

Create a color scheme

Color schemes are stored in /usr/share/color-schemes/FooBar.color. To create a new one, just copy an existing one:

  • cp /usr/share/color-schemes/FooBar.color ~/.local/share/color-schemes/MyScheme.color

Customize color scheme

Now you have to fix the metadata of the scheme and customize the colors:

  • Metadata are in the MySchema.color at the button in the [General] section
  • Change the Name here

Now you can adjust the colors. KDE has a tool for that, just search for “Colors”, select your scheme and change the colors. Unfortunately the changes are written to a local files called ~/.config/kdeglobals, which is not your new color scheme. I just copied the content to my color scheme, so what I did was:

  • Use the KDE tool to customize colors (just search for “Colors”)
  • Copy color-relevant content from ~/.config/kdeglobals
  • Replace the old section in MySchema.color with the ones you just copied

All properties that can be set are listed here: https://hig.kde.org/style/color/dark.html

Create a desktop theme

Now you need a theme you can select in the KDE settings. Themes are in /usr/share/plasma/desktoptheme/ and also here I just copied an existing folder to ~/.local/share/plasma/desktoptheme/my-theme/:

  • Copy existing theme:¬†cp /usr/share/plasma/desktoptheme/foo-bar/ ~/.local/share/plasma/desktoptheme/my-theme/

The colors file can be replaced by the one of the color scheme

  • cp /usr/share/color-schemes/MyScheme.color ~/.local/share/plasma/desktoptheme/my-theme/colors
  • Change the name of the theme in the metadata.desktop file

Many applications already work with these settings, but widgets don’t.

Customize widget colors

Widgets have their own styles in /usr/share/plasma/desktoptheme/foo-bar/widgets/. The default theme of KDE (Breeze) however does not have a style for widgets. Instead the default style for widgets from /usr/share/plasma/desktoptheme/default/widgets/ is used. So the default widget style is actually the Breeze widget style. To change that style, just copy one from e.g. .../default/ into your own theme folder.

  • cp -r /usr/share/plasma/desktoptheme/default/widgets/ ~/.local/share/plasma/desktoptheme/my-theme/widgets/

Now you have a .../my-theme/widgets/ folder with lots of .svgz files in it which are compressed .svg files. To change them, just decompress them:

  • Decompress .svgz files with gzip -d -S svgz *.svgz
  • Restore file endings with for i in *.; do mv "$i" "${i%.*}.svg"; done

Now you can edit every file manually or use the power of sed to edit all at once. Say you want to replace the color #3daee9 (default Breeze color) by #b89c0f:

  • sudo find . -type f -exec sed -i 's/#3daee9/#b89c0f/g' {} +

Of course there are other colors that can be changed, but that was enough for me.

Reload and done

Now all styles, themes and colors are customized and you just need to reload KDE:

  • plasmashell --replace &

If you have any problems, feel free to comment.

Facebooktwittergoogle_plusredditpinterestlinkedinmail

2 Comments

  1. Eike

    You shouldn’t have to edit the desktop theme SVGs to swap out colors, fwiw – at least the default “Breeze” theme will auto-adapt to the system color scheme.

    Reply
    1. Hauke Stieler (Post author)

      Oh, you’re right. I only used the “Breeze Dark” theme and the widgets didn’t auto adapt the colors. It’s a bit strange that I have to select the normal “Breeze” theme so that colors are adapted, isn’t it? Is this the expected behaviour?

      Reply

Leave a Comment

Your email address will not be published.