DEV Community

ankit-brijwasi
ankit-brijwasi

Posted on • Updated on

Enable Dark mode in chrome on Ubuntu

Recently I started using Ubuntu as my default OS for programming and I am loving working in it!

But there was an issue which I faced, By default in Google Chrome dark mode is not enabled and it was kind of a letdown.

After digging up the Internet I found that In order to enable the Dark mode I needed to edit the google-chrome.desktop file.

If you are also dealing with a similar issue then, just follow along

Firstly open, the google-chrome.desktop file using,
sudo gedit /usr/share/applications/google-chrome.desktop

After the file has been opened, you will need to edit two lines

1. Search for the line-

Exec=/usr/bin/google-chrome-stable %U
Enter fullscreen mode Exit fullscreen mode

replace it with-

Exec=/usr/bin/google-chrome-stable %U --enable-features=WebUIDarkMode --force-dark-mode
Enter fullscreen mode Exit fullscreen mode

2. Search for the line-

Exec=/usr/bin/google-chrome-stable
Enter fullscreen mode Exit fullscreen mode

replace it with-

Exec=/usr/bin/google-chrome-stable --enable-features=WebUIDarkMode --force-dark-mode
Enter fullscreen mode Exit fullscreen mode

Now, Save the file and restart Chrome. Dark mode should be enabled now

Thanks for reading!
Have a nice day!😇

Top comments (8)

Collapse
 
knufle profile image
Marcel • Edited

Thank you, Ubuntu 20.04.4 LTS here and it definitely works. However, it seems that the "google-chrome.desktop" file gets overwritten once Chrome updates and then you lose all the config again, did that happen to you? If so, do you know any fixes?

Collapse
 
ankitbrijwasi profile image
ankit-brijwasi

Yeah, but I don't know if this is fixable or not😕

Collapse
 
tarash profile image
Taras Habrylchuk

My workaround, run with sudo this shell script.
sed -i 's/^Exec=\/usr\/bin\/google-chrome-stable$/& --enable-features=WebUIDarkMode --force-dark-mode/' /usr/share/applications/google-chrome.desktop
sed -i 's/%U/--enable-features=WebUIDarkMode --force-dark-mode &/' /usr/share/applications/google-chrome.desktop

Collapse
 
mouhzero profile image
MOUHSSINE

Thank you for this, every-time I updated chrome I come back here to make it dark again ;).
I have Ubuntu 22.04

Collapse
 
ankitbrijwasi profile image
ankit-brijwasi

Gald to know, that it helped you🥳😇

Collapse
 
rjfranco_95 profile image
RJ Franco

It worked for me after I restarted my entire session.
Thanks a lot

Collapse
 
ankitbrijwasi profile image
ankit-brijwasi

Glad to know!🥳😇

Collapse
 
thomasbnt profile image
Thomas Bnt ☕

Great post! You can add

#linux

What are clouds made of? Linux servers, mostly.
to your post if you want 💪🏼