Qt Theming on Ubuntu and other GNOME Desktops

I recently wrote about how to get a full dark theme on Ubuntu by enabling the dark option in the GNOME Appearance Settings followed by installing the User Themes GNOME extension to set the Yaru-dark shell theme in Tweaks. That covers the desktop shell and GTK+ applications but I forgot one other important aspect.

Qt applications will not inherit the system theme by default. They need to be themed separately. As an example, let’s use a popular Qt application that you might be using, SimpleScreenRecorder. If you were to have gone to the trouble of setting the dark theme as I’ve previously described you’ll notice that when you open SimpleScreenRecorder you’ll see this.

Not exactly what I was hoping for. But with some fairly simple changes we can make it look like this.

There are various options for doing this but one of the easiest and most configurable options I’ve found is using Kvantum.

From the Kvantum GitHub page:

Kvantum (by Pedram Pourang, a.k.a. Tsu Jan) is an SVG-based theme engine for Qt, tuned to KDE and LXQt, with an emphasis on elegance, usability and practicality. Its homepage is https://github.com/tsujan/Kvantum.

Kvantum has a default dark theme, which is inspired by the default theme of Enlightenment. Creation of realistic themes like that for KDE was my first reason to make Kvantum but it goes far beyond its default theme: you could make themes with very different looks and feels for it, whether they be photorealistic or cartoonish, 3D or flat, embellished or minimalistic, or something in between, and Kvantum will let you control almost every aspect of Qt widgets.

Kvantum also comes with extra themes that are installed as root with Qt5 installation and can be selected and activated by using Kvantum Manager.

Note that this tutorial is specific to Ubuntu but is easily adapted to other distributions, many of which already have these packages in their repositories. The GitHub page linked above also has instructions on how to install Kvantum on various distributions. Some distributions, like Manjaro, come with Kvantum already installed. If you’d like some help getting this set up let me know if the comments below.

Let’s start by installing a few packages.

sudo apt install qt5-style-kvantum qt5-style-kvantum-themes

This will install Kvantum and the default themes as mentioned in the quote above. The next step is to set the system to use Kvantum to style Qt applications. You need to add this to your ~/.profile file. You can either edit it manually, adding export QT_STYLE_OVERRIDE=kvantum to the end of the file or by using the command below, which will do the same thing by appending the string to ~/.profile.

echo "export QT_STYLE_OVERRIDE=kvantum" >> ~/.profile

You need to restart your desktop session for this to take effect so log out and back in. Now you can move on to setting the theme in Kvantum.

The default Kvantum theme, while dark, doesn’t match Yaru particularly well.

In particular, things like buttons and highlight colors don’t match the Yaru Dark theme. Luckily there are more Kvantum themes available on the KDE Store website. The one that matches best is called MateriaYaru.

Download the MateriaYaru_Kvantum.tar.gz file and extract it. From within Kvantum, choose the Install/Update Theme section and browse to the extracted folder. Find the MateriaYaruDark folder and select it.

Click Install this theme and then switch to the Change/Delete Theme section and select it from the drop down list (it will be all the way at the bottom). Click Use this theme and you should see that the Kvantum window changes to something much closer to Yaru Dark.

Now when you open SimpleScreenRecorder you should see that it has a dark theme that matches the rest of your desktop.

That should do the trick. Now all your Qt apps should have a pleasant dark theme that matches everything else and won’t make you jump out of the chair when you open them in a darkened room.

If you have any problems getting this set up let me know in the comments or if you have a better solution for this I’d love to hear it. Thanks for reading and enjoy your (actual) full dark mode desktop.

Tweets