Software & AppsOperating SystemLinux

How To Enable System Dark Mode for Google Chrome on Ubuntu 20.04

Ubuntu 5

In this article, we will be discussing how to enable the system dark mode for Google Chrome on Ubuntu 20.04. This guide will be helpful for those who prefer using a dark theme for their applications to reduce eye strain or simply for aesthetic reasons.

Quick Answer

To enable system dark mode for Google Chrome on Ubuntu 20.04, you can use the --force-dark-mode command line switch when launching Google Chrome. This forces Google Chrome to start in dark mode, regardless of the system’s theme. Additionally, you can modify Google Chrome’s desktop entry file to make dark mode permanent.

Prerequisites

Before proceeding, make sure you have the following:

  • Ubuntu 20.04 installed on your system
  • Google Chrome installed on your system

Switching Ubuntu to Dark Mode

The first step is to switch your Ubuntu system to dark mode. This can be done using the gnome-tweak-tool. If you don’t have it installed, you can install it using the following command:

sudo apt install gnome-tweaks

Once installed, open the tool and navigate to the “Appearance” section. Here, you should see an option for the Shell theme. Select the “Yaru-dark” theme from the dropdown menu.

Enabling Dark Mode in Google Chrome

After changing the system theme, you may notice that Google Chrome does not automatically switch to dark mode. This is due to an open issue in Linux where Google Chrome does not recognize the system’s dark mode preference.

To overcome this, we can use the --force-dark-mode command line switch when launching Google Chrome. This forces Google Chrome to start in dark mode, regardless of the system’s theme.

You can do this by opening a terminal and running the following command:

google-chrome --force-dark-mode

Making Dark Mode Permanent in Google Chrome

If you want Google Chrome to always start in dark mode, you can modify its desktop entry file. This file is typically located in ~/.local/share/applications/ and is named chrome-xxxxxxxx.desktop (where ‘xxxxxxxx’ is a unique identifier).

To modify the file, open it in a text editor of your choice. Look for the line that starts with Exec and add the --force-dark-mode switch to it. The line should look like this after modification:

Exec=/usr/bin/google-chrome-stable --force-dark-mode %U

In this command, /usr/bin/google-chrome-stable is the path to the Google Chrome executable, --force-dark-mode is the switch that forces dark mode, and %U is a field code that stands for a URL or list of URLs.

Using a Specific GTK Theme

Another option is to start Google Chrome with a specific GTK theme using the command line. The following command will start Google Chrome in a new window with the “Yaru-dark” theme:

env GTK_THEME="Yaru-dark" google-chrome --new-window

In this command, env is a shell command used to set an environment variable, GTK_THEME is the environment variable that sets the GTK theme, and google-chrome --new-window is the command that starts Google Chrome in a new window.

Conclusion

In this article, we discussed how to enable the system dark mode for Google Chrome on Ubuntu 20.04. We covered how to switch the system to dark mode, how to force Google Chrome to start in dark mode, and how to make this change permanent. We also discussed how to start Google Chrome with a specific GTK theme.

While the issue of Google Chrome not recognizing the system dark mode preference is expected to be fixed in future releases, the methods discussed in this article provide a reliable workaround for the time being.

Can I enable system dark mode for Google Chrome on other versions of Ubuntu?

Yes, you can enable system dark mode for Google Chrome on other versions of Ubuntu by following similar steps. However, the specific paths and commands may vary slightly depending on the version of Ubuntu you are using.

Can I enable dark mode for other applications on Ubuntu using the same method?

Yes, you can enable dark mode for other applications on Ubuntu using the same method of switching to a dark theme in the system settings and using the --force-dark-mode command line switch when launching the application. However, not all applications may support dark mode or have the same command line switch, so it may vary depending on the application.

Will enabling dark mode in Google Chrome affect the appearance of websites?

Enabling dark mode in Google Chrome only affects the appearance of the browser’s user interface, not the appearance of websites. Websites will still be displayed in their original design and colors unless they have their own dark mode feature.

Can I revert back to the default light mode in Google Chrome?

Yes, you can revert back to the default light mode in Google Chrome by removing the --force-dark-mode switch from the Google Chrome desktop entry file or by launching Google Chrome without the switch in the command line.

Will enabling dark mode in Google Chrome affect the performance of the browser?

Enabling dark mode in Google Chrome should not have a significant impact on the performance of the browser. The dark mode feature mainly affects the appearance of the user interface and does not consume additional system resources.

Leave a Comment

Your email address will not be published. Required fields are marked *