Search code examples
firefoxfirefox-addon-webextensionsweb-ext

web-ext: How to run Firefox in dark mode?


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 [email protected]

Solution

  • 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