Dark mode switching

From ArchWiki
Jump to navigation Jump to search

Switching between light and dark modes/themes is nice to have. It allows you to switch to dark mode on sunset or toggle modes with a keyboard shortcut.

The switch between themes can apply to currently running programs, probably requiring a daemon, or only to newly launched ones. This article focuses on switching at runtime, so toggling during use affects currently running programs.

Switching between light and dark mode requires support from applications or application toolkits like GTK and Qt.



To change the light/dark mode, you have to change the used theme.

Most themes do have a dark variant and those have by convention the suffix -dark. For example the default GTK theme Adwaita has the variant Adwaita-dark.

To permanently change to the dark variant, see GTK#Dark theme variant

To switch themes instantly for running programs, a daemon providing the xsettings spec is required.

The one from Xfce is xfsettingsd, which is provided by the xfce4-settings package.

To query current GTK theme:

$ xfconf-query -c xsettings -p /Net/ThemeName

To set GTK theme:

$ xfconf-query -c xsettings -p /Net/ThemeName -s "new-theme"

Changes to this entry are instant and affect all GTK applications.


Qt has theme support similar to GTK.

One method to theme Qt applications is using GTK for styling. Changes to the GTK theme then affect Qt applications as well.



Firefox automatically uses the current GTK theme mode and adapts the appearance of the browser accordingly. See Firefox#Dark themes for some more settings and caveats.

To change web content smartly, the Dark Reader Add-On is recommended.

By setting Automation to Use system color scheme, Dark Reader activates automatically with dark GTK themes.


Thunderbird conforms with the current GTK Theme, but some changes are recommended.

See Thunderbird#Theming tweaks.

Visual Studio Code

To change the theme in Visual Studio Code, this script may help.


Alacritty has support for multiple custom color schemes. The configuration syntax and published color schemes can be found here.

To quickly change theme, you should declare a pointer to each color scheme, for example &black. Then you can switch to a color scheme by simply setting colors: *black. This change to the configuration file is instant and affects all currently running instances.

The borders and title bar are themed with GTK. To abide by the GTK theme, you should set the setting gtk_theme_variant to the default None.