I have been a long-term lover of Dark Mode and in the year 2022, I can’t think of not using dark mode wherever possible. We have had universal dark mode support in Linux for quite a while now and most apps follow your desktop environment’s dark mode, except for Google Chrome. I don’t get it, all the chromium-based browsers I’ve tried like Opera, Vivaldi, Brave, etc all follow universal dark mode but not Chrome! Not to mention Firefox also follows universal dark mode. I had to do some digging around to find a fix as Chrome is my primary web browser.

The Solution

Google Chrome for Linux actually has a dark mode, it just doesn’t automatically switch to the dark mode if we are using universal dark mode. We can activate it using the following flag: --force-dark-mode. So you can run the command google-chrome-stable --force-dark-mode to launch Chrome in dark mode.

Making Dark Mode Default

To make this behavior default, we can set it in the .desktop files so chrome will always load in dark mode whenever you are launching using your application launcher (use GUI to launch Chrome). The google-chrome.desktop file resides on /usr/share/applications but we won’t be editing that for two reasons:

  1. We can’t edit any files inside /usr/share/applications with many of the text editors as our users don’t have the permission to edit the file. I like to skip using the CLI for my tutorials so you don’t need to be an expart to follow my tutorials.
  2. An update of Google Chrome can overwrite the file so even if we make changes to that file, we have to do it every time chrome updates.

This is what we’ll do instead:

  1. Let’s copy the google-chrome.desktop file from /usr/share/applications to /home/<YourUserName>/.local/share/applications.
    If you are in Ubuntu:
    1. Open Files
    2. Then go to “Computer“, usr, share, applications folder.
    3. Copy the google-chrome.desktop file from there.
    4. Then, go back to your Home.
    5. Now You need to enable Show hidden files by either doing it from the hamberger menu or you can press Ctrl+H to show or hide hinnden files.
    6. Then navigate to .local, share, applications
    7. Paste the file there.
  2. Now we need to edit the pasted file and add the flag --force-dark-mode on every line with Exec=/usr/bin/google-chrome-stable. They should look like this:
    • Exec=/usr/bin/google-chrome-stable --force-dark-mode %U
    • Exec=/usr/bin/google-chrome-stable --force-dark-mode
    • Exec=/usr/bin/google-chrome-stable --incognito --force-dark-mode
  3. Save the file and you are done!

If you have chrome running during this time, you need to relaunch it or you may even need to re-login into your desktop session.

That’s it, enjoy dark mode!