How to change Firefox theme from outside of browser without restart?

In Manage Your Themes section there are options such as Light, Dark and System. When I click on any of them, Firefox's UI changes immedeately.

Is it possible to change this setting from the command line by editing some config files or possibly some user session script, and see the effects without having to restart the browser?

When it is set to "System", how exactly does Firefox determine whether system theme is light or dark?

I'm on Debian with a gtk-based desktop.

3 comments · 67% upvoted · other discussions

comments

ropid

The desktop sends a D-Bus message about the color-scheme change when the switch between light and dark happens. Programs listen for that. There's only values for light and dark for this from the system.

ResurgamS13

Re: "determining whether system theme is light or dark"... IIRC the 'switch' for light/dark system themes is triggered at a set colour value (darkness level) of the text in non-active tabs... see the general explanation in first paragraph of 'Use themes to change the look of Firefox' article:

https://preview.redd.it/qtnruwgkmkxd1.png?width=1151&format=png&auto=webp&s=5932bdb9311cef8f6eeadde2c8f48337b97c2f93

Thus, if want a 'light' browser UI (i.e. panels & menus have dark text on near white background)... then lightweight toolbar themes that use black or dark text in the non-active tabs are good.

Conversely, if want a 'dark' browser UI (i.e. panels and menus have light text on near black background)... then lightweight toolbar themes that use white or light text in the non-active tabs are good.

-------

PS. Somewhere on Mozilla Support (SUMO) there is a jscher2000 reply that narrows down what level of 'darkness' in the non-active tab text is the 'switch-over' point between light & dark system themes. For the more technically-minded the mathematical calculation can be found in Searchfox... somewhere! :)