Dark color scheme switch for Byzantium

In Crimson, there will be a toggle in settings to switch between the dark and the default color schemes of the interface at will. In this forum, there were enough examples of how to reproduce a similar functionality. Here I share what I currently use in Byzantium. It allows switching the color scheme with a single icon in the applications drawer, which is convenient for Librem 5. On a desktop, I would assign a keyboard shortcut instead.

$ cat ~/.local/bin/color-scheme-switch
#! /bin/bash

CURRENT=$(gsettings get org.gnome.desktop.interface color-scheme)

if [[ "$CURRENT" == "'prefer-dark'" ]]; then
	gsettings reset org.gnome.desktop.interface color-scheme
	gsettings reset org.gnome.desktop.interface gtk-theme
else
	gsettings set org.gnome.desktop.interface color-scheme prefer-dark
	gsettings set org.gnome.desktop.interface gtk-theme Adwaita-dark
fi

The first setting is for newer applications. The older applications or older versions of applications require the second setting instead which switches the GTK theme.

$ cat ~/.local/share/applications/color-scheme-switch.desktop
[Desktop Entry]
Name[uk]=Π—Π°Ρ‚Π΅ΠΌΠ½ΠΈΡ‚ΠΈ
Name=Darken
Comment[uk]=ΠŸΠ΅Ρ€Π΅ΠΌΠΊΠ½ΡƒΡ‚ΠΈ ΠΊΠΎΠ»Ρ–Ρ€Π½Ρƒ схСму
Comment=Switch the color scheme
Keywords[uk]=Π’Π΅ΠΌΠ½Π°;Π‘Π²Ρ–Ρ‚Π»Π°;Ніч;Π”Π΅Π½ΡŒ;ΠŸΠ΅Ρ€Π΅ΠΌΠΊΠ½ΡƒΡ‚ΠΈ;Π’Π΅ΠΌΠ°;Π—Π°Ρ‚Π΅ΠΌΠ½ΠΈΡ‚ΠΈ;Darken;
Keywords=Dark;Light;Night;Day;Switch;Theme;Darken;
TryExec=/home/purism/.local/bin/color-scheme-switch
Exec=/home/purism/.local/bin/color-scheme-switch
Icon=video-display
Terminal=false
Type=Application
Categories=GTK;GNOME;Settings;System;Utility;
StartupNotify=false
OnlyShowIn=GNOME;Phosh;
X-Purism-FormFactor=Workstation;Mobile;
8 Likes