Automatic Toggle Light / Dark Theme at Day & Night in Ubuntu Gnome

For Ubuntu, Fedora, and other Linux with Gnome Desktop, here’s how to enable automatically toggle dark mode at night, and light mode during the day.

Night Theme Switcher is a Gnome Shell extension enables automatic toggle GTK theme, shell theme, icon and cursor themes, switch backgrounds and run custom commands at sunset and sunrise.

To install the extension in Ubuntu 20.04 & higher, do following steps one by one:

  1. Open terminal from your system application launcher. When it opens, run command:
    sudo apt install chrome-gnome-shell

  2. Then go to extension web page in your browser. And turn on the toggle icon to install it.

    Don’t see the toggle icon? Click the link “Click here to install browser extension” and refresh the page.

Once installed the extension, open Gnome Tweaks and click the gear button to change the preferences.

Since Ubuntu 21.10, user need to install Gnome Extensions app by opening terminal and run command:
sudo apt install gnome-shell-extension-prefs
Finally search for and open the app from Activities overview and start configuring your extensions.

By default, it will try to use Night Light or Location Services to automatically set your current sunrise and sunset times if they are enabled. You can override it and use a manual schedule by turning on the second toggle icon. And, it will add a ‘waning moon‘ icon in system tray, as well as Super + Shift + T keyboard shortcut allow to toggle dark and light.

While default settings are OK to work, you can change the day and night variants for GTK, Shell, Cursor, and Icon themes, background, and custom commands.

To get full dark mode (panel menus, notifications, calendar, etc) at night, you have to first install and enable User Themes extension. Then manually set Night variant to Yaru-dark under Shell theme tab.

That’s it. Enjoy!

Hi, I'm Merilyn Ne, a computer geek working on Ubuntu Linux for many years and would like to write useful tips for beginners. Forgive me for language mistakes. I'm not a native speaker of English.