Dark mode switching
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.
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
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.
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.
To change web content smartly, the Dark Reader Add-On is recommended.
Use system color scheme, Dark Reader activates automatically with dark GTK themes.
Thunderbird conforms with the current GTK Theme, but some changes are recommended.
Visual Studio Code
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