The GNOME approach to the problem is to provide consistent default and dark themes in applications and to support switching the theme globally with a single button (as well as per application via GUI or gsettings
configuration). Support for Dark Mode is one of the requirements for inclusion into the GNOME Circle, so it is expected to be supported in most current GNOME applications.
GNOME version 43 came with quick toggles available immediately in GNOME shell's system menu in the right top corner of the screen. One of the toggles is for the Dark Mode, which was introduced before. You can access and change it any time as easy as changing the sound volume. It effectively changes the appearance of all applications with Dark Mode support (including most current GNOME applications) unless they are configured to ignore it. One example is the default GNOME Terminal in Debian which does not change automatically. The Dark Mode also changes the colours in the background image for a consistent dark theme.
The current stable release version of Debian is 11. It has GNOME version 3.38.6. It does not support the new dark theme. The new stable release of Debian is planned for 10 June 2023. It has GNOME version 43.4. I checked RC 2 and it indeed supports Dark Mode as expected with the global switch conveniently available.
So, you could upgrade to Debian 12 Bookworm, which is currently in release candidate 2, by changing stable
or bullseye
to bookworm
in your sources.list
. But the release is expected in a month, so I would just wait for it and upgrade to the new release as usual.
Firefox automatically supports out-of-the-box changing of the theme of its interface elements when the Dark Mode in GNOME is enabled or disabled. To extend this to the contents of the webpages, you need to install the Dark Reader Firefox addon. Enable the automatic switching based on the system colour scheme in the settings of the addon in the top right corner. (Check the mark next to "The system colour scheme".) Then, the contents of the webpages will change automatically when you switch the theme globally, so you can browse in the dark or in the light in consistency with the whole desktop.
Visual Studio Code supports switching its colour theme from dark to light and back automatically based on the colour theme of the operating system. You can enable this feature in the application in Settings → Window → Auto Detect Color Scheme. It is supposed to change automatically every time you change the GNOME theme globally with the button. It does not work now due to a bug in Electron, which was recently fixed. So Electron version 25, which is expected on 30 May 2023, should come without the bug, but I am not sure about earlier still supported versions. The current version of the .deb
-packaged VS Code uses Electron version 22.5.2, which support ends on 30 May 2023. It might take some more time before the automatic change of the theme will work in VS Code.
I see that the application that you used before can be switched with a shortcut:
Win+Alt+N: switch between normal mode and colors inversion mode (Night vision )
GNOME does not provide a shortcut by default but there are multiple ways for getting one. What worked for me was to make a shell script and assign a shortcut to it.
The dark theme can be switched on or off by setting the following GSettings value. I checked the values when the theme is on and off respectively:
$ gsettings get org.gnome.desktop.interface color-scheme
'prefer-dark'
$ gsettings get org.gnome.desktop.interface color-scheme
'default'
Next, I checked the shell path:
$ type $0
bash is /usr/bin/bash
$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
$ ls ~/.local/bin
ls: cannot access '/home/test/.local/bin': No such file or directory
I would eventually add ~/.local/bin
to $PATH
but it is unnecessary for a single script. Apparently, you can use a different location for your script.
$ mkdir .local/bin
$ type shade
bash: type: shade: not found
$ nano .local/bin/shade
$ chmod +x .local/bin/shade
Here is my script. It checks the current value and changes it to the other one.
#! /usr/bin/bash
CURRENT=$(gsettings get org.gnome.desktop.interface color-scheme)
if [[ "$CURRENT" == "'default'" ]]; then
gsettings set org.gnome.desktop.interface color-scheme prefer-dark
elif [[ "$CURRENT" == "'prefer-dark'" ]]; then
gsettings set org.gnome.desktop.interface color-scheme default
fi
Then, go to Settings → Keyboard → Keyboard Shortcuts → View and Customize Shortcuts → Custom Shortcuts → Add Shortcut. Fill in a name, such as "GNOME Dark Theme Switch". Since we did not add the script to the path, provide the full path to the script such as /home/test/.local/bin/shade
. Then, select "Set Shorcut" and type your combination such as Super+Alt+N. Finally, hit "Add".
All applications change at the same time. When the quick toggle is clicked, the transition takes a second and happens gradually and softly. When the GSettings
value is set either directly or through the shortcut, the new theme is applied immediately. In the latter case, the transition may lag for a fraction of a second on a few elements in some applications which were probably not designed for this. Firefox Dark Reader typically changes the colours at the same time but may lag behind for a fraction of a second on more complex websites.