Toggle Light & Dark Mode for Flatpak Apps in Ubuntu 20.04+ / Linux Mint

Last updated: October 13, 2021 — 3 Comments

Using Flatpak apps in Linux? You may found that Flatpak app appearance does not change when toggling light & dark mode or switching to another app theme.

As more and more apps publish Linux packages via Flatpak, I have a few of them installed in my Ubuntu laptop. However, the apps stick to the light theme whenever I switches to dark mode in Appearance settings.

Since Flatpak runs in sandbox and does not have permission to access the “/usr” directory, it does not use system theme according to the document. So, some popular GTK themes are packaged as Flatpaks. And, it detects the current system app theme and tries to install the Flatpak version of the theme if available during app installation or update.

I’m working with default Yaru theme in the most time, so it automatically installs Yaru theme flatpak package but leaves Yaru Dark not installed. When I switching to Yaru Dark, it can’t find the match theme so falls back to the default Adwaita.

Install GTK Themes in Flatpak:

As all I said, the solution is install the themes you use as Flatpak packages.

For Ubuntu 20.04 and higher that use the default Yaru app theme, press Ctrl+Alt+T on keyboard to open terminal and run command:

  • Install the Dark theme by running command:
    flatpak install flathub org.gtk.Gtk3theme.Yaru-dark
  • Or install the light theme if not exist via command:
    flatpak install flathub org.gtk.Gtk3theme.Yaru-light

There are also elementary stylesheet, Deepin GTK theme, Linux Mint’s Mint-Y in different colors, Arc, Numix, and other themes in Flatpak package format. You can find more themes via command:

flatpak search gtk3theme

Then install your prefer theme via “flatpak install flathub app-id” command.

After that, change app theme via Gnome Tweaks or System Settings to see the magic!

Make theme working for Qt apps:

Though I don’t have Qt applications as Flatpaks, according to the document, you need to open terminal and run following commands one by one to install the required runtime libraries:

flatpak install org.kde.KStyle.Adwaita
flatpak install org.kde.PlatformTheme.QGnomePlatform

That’s all. Enjoy!

Twitter

I'm a freelance blogger who started using Ubuntu in 2007 and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please comment to let me know if the tutorial is outdated! And, notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me via ubuntuhandbook1@gmail.com Buy me a coffee: https://ko-fi.com/ubuntuhandbook1

3 responses to Toggle Light & Dark Mode for Flatpak Apps in Ubuntu 20.04+ / Linux Mint

  1. I tried to make Okular (Flatpak) install/open in dark theme.
    After I used the last two commands you recommended:
    flatpak install org.kde.KStyle.Adwaita
    flatpak install org.kde.PlatformTheme.QGnomePlatform
    the Okular stopped opening at all.
    I tried to uninstall it and re-install it, but i would not help.
    It looked like it got installed, but it would not open.
    Is there a way to reverse the last commands?

    • You may undo the two commands via:

      flatpak uninstall --delete-data org.kde.KStyle.Adwaita
      flatpak uninstall --delete-data org.kde.PlatformTheme.QGnomePlatform

      BTW: Okular is a KDE app, in fact it does not follow GNOME’s light/dark mode changes…

  2. Does not work for selfmade theme :-(
    Still everything flatpak is glaring white.

Leave a Reply

Text formatting is available via select HTML.

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> 

*