Search code examples
google-chromeelectronchromium

How to enable Electron to use chrome://flags/#enable-force-dark


We found the chrome flag chrome://flags/#enable-force-dark that forces all websites to use dark mode and it's quite nice actually!

We cannot get this flag to work in Electron, however. Here's what we tried:

app.commandLine.appendSwitch('enable-force-dark');
app.commandLine.appendSwitch('force-dark-mode');
app.commandLine.appendSwitch('enable-features', 'enableForceDark');
app.commandLine.appendSwitch('enable-features', 'WebUIDarkMode');

Sadly, none of them work. Any pointers would be appreciated.


Solution

  • The Electron docs specify a list of supported command line switches (some of which do come from Chromium). Unfortunately, --enable-force-dark is not on that list.