0

I'm working on a new browser extension and I'm using Mozilla's web-ext tool to test it. I couldn't figure out how to run the test browser in dark mode.

So far I have tried this:

web-ext run --verbose --pref extensions.activeThemeID=firefox-compact-dark@mozilla.org
Mehmet Baker
  • 1,055
  • 9
  • 23

1 Answers1

0

I figured out a way! Apparently, dark mode is an add-on; not a preference.

First step is to create an empty directory to store our Firefox profile.

mkdir ../dark-mode-profile
npx web-ext run -p ../dark-mode-profile --keep-profile-changes

Then enable dark mode and close Firefox (and hit Ctrl-C if necessary). Since we turned on the --keep-profile-changes flag, all the changes we made are now stored in our profile folder.

We can run Firefox with this profile:

npx web-ext run -p ../dark-mode-profile
Mehmet Baker
  • 1,055
  • 9
  • 23