Enable Chrome Dark Mode on Ubuntu Desktop 20.04 or 21.04

dark modegoogle-chromeUbuntuubuntu-20.04

On Windows, when I set the system UI to "Dark mode", Google chrome automatically recognizes this and does the same, (some) modern website in turn recognize this setting aswell and also apply their own "dark theme".

For example youtube.com has settings in the top-right corner for "Appearance", one of the options is "Use device theme", which makes youtube.com dark on windows 10 (when you set windows itself to darkmode)

Is there a way to achieve this on Ubuntu 20.04? To have modern websites "read" the OS' dark / light mode settings?

And if not, is this feature added on the 21.04 Ubuntu by any chance? Because I could also just install that version.

Best Answer

For chrome specifically this is the fix:

sudo sed -i 's;/usr/bin/google-chrome-stable;/usr/bin/google-chrome-stable --enable-features=WebUIDarkMode --force-dark-mode;g' /usr/share/applications/google-chrome.desktop
Related Question