How do I stop the brief white background in Firefox when opening new tabs, even in dark mode?

I run Firefox in "dark mode". If I, for example, middle-click a bookmark in the bookmarks menu, it briefly shows a 100% white background before rendering the actual page (which is dark). In spite of me using dark mode.

The same thing happens when I open a new tab; 100% white background instead of matching the dark mode. This is extremely jarring.

As with so many things, Mozilla has crippled Firefox even this regard, so that you are only allowed these two choices for "new tabs":

  1. "Firefox Home (Default)". This one is ugly and "heavy" beyond words and also designed to spy on you. I refuse to have anything to do with it.
  2. "Blank Page". This means 100% white even though Firefox is in "dark mode". You'd think it would mean "whatever color is the basis of the current theme"...

Just above that setting, there is a similar preference for "Homepage and new windows". This one has the same choices as above, but also a "custom URLs" one! If that option had been available for "new tabs", I could probably have fed it a local HTML file which just paints a dark background, as an ugly but workable work-around, but that option just doesn't exist. I don't know if it has existed in the past.

How can I get rid of that "flashing light" as the brief white background looks like to me countless times a day?


Solution 1:

I recently looked for a solution to this as well after getting flashbanged at night or on dark mode. The info on this page was able to solve it for me: https://fedidat.com/640-dark-newtab-firefox/

In about:config, change the browser.display.background_color preference to a color of your choice (mine is #808080 for example).

In userChrome.css, add the following code and replace #808080 with your color.

#browser vbox#appcontent tabbrowser, #content, #tabbrowser-tabpanels, 
browser[type=content-primary],browser[type=content] > html {
    background: #808080 !important
}

One side effect I noticed is that some web pages do not have a background color, so before they defaulted to white but now they use my gray color. Sometimes this can affect readability. The trick is to find a gray that works for you so the flash is not bright but also so that you can read pages.