Skip to content

Instantly share code, notes, and snippets.

@gmolveau
Last active April 30, 2024 21:38
Show Gist options
  • Star 117 You must be signed in to star a gist
  • Fork 9 You must be signed in to fork a gist
  • Save gmolveau/a802ded1320a7591a289fb7abd0d6c45 to your computer and use it in GitHub Desktop.
Save gmolveau/a802ded1320a7591a289fb7abd0d6c45 to your computer and use it in GitHub Desktop.
Firefox dark background / theme for new tab and loading screen

Firefox Dark Background

  • How to change the background on Firefox to a dark one on new tab / loading screen ?

Procedure

  • Type about:config in the URL bar
  • Search toolkit.legacyUserProfileCustomizations.stylesheets and double-click the field to set it to true
  • Type about:support in the URL bar
  • Look for Profile folder field and click on the open button next to it.
  • Create a folder with the name chrome
  • Inside this folder, create a file userChrome.css and paste the following code inside it :
tabbrowser tabpanels { background-color: rgb(19,19,20) !important; }
browser { background-color: #131314 !important; }
  • Then create another file userContent.css and paste the followind code in it :
@-moz-document url-prefix(about:blank) {
    html > body:empty {
        background-color: rgb(19,19,20) !important;
    }
}
@-moz-document url(about:blank) {
    html > body:empty {
        background-color: rgb(19,19,20) !important;
    }
}
  • Completely quit and restart firefox

  • Enjoy

@e-t-l
Copy link

e-t-l commented Nov 9, 2023

@Arian04 That's reasonable troubleshooting advice, but I already use userchrome.css and usercontent.css, so I can definitely tell that they're working. And I don't see any styles in there that would obviously conflict with the code here, either.

@Arian04
Copy link

Arian04 commented Nov 9, 2023

@e-t-l hmm, just to rule out anything in your entire profile causing problems, maybe try this change on a fresh Firefox profile and see if it works there?

edit: by the way, which sites do you notice this behavior in? bc I've noticed it with Pearson's sites and I think it's because the site loads an intentionally white page before the content loads (and somehow dark reader isn't catching it) because I have noticeable black loading screens on all other sites.

@SpazMahTazz
Copy link

I notice that when I left click a link that opens in a new tab, the white flash happens. Sometimes left click opens the link in the current tab, but sometimes it's into a new tab (such as links from a Google search). However if I press ctrl+click to purposely open links into a new tab then there is no white flash. This is with dark mode enabled, and it's been tested on a fresh install of Firefox. So try use ctrl+click as often as possible until there's a proper fix I reckon.

@e-t-l
Copy link

e-t-l commented Nov 10, 2023

Actually in order to avoid seeing the flash, if I can't prevent it from happening, I've set the following prefs (for Firefox) to true:

  • browser.tabs.loadInBackground
  • browser.tabs.loadBookmarksInBackground
  • browser.tabs.loadDivertedInBackground

As long as I wait at least one second before switching to the new tab, I won't see the white flash.

@QiuWeimengChan
Copy link

It's great, and the latest version (119.0.1) on Windows works. Thanks also to e-t-l(@e-t-l ) for the additional notes. Totally black looks good on the eyes.

@BruceLP
Copy link

BruceLP commented Jan 17, 2024 via email

@parMaster
Copy link

Deleted my previous comment, because I found a solution and wanted to tried it out on different devices and OS's. So, in my case the white flashes reappeared on some computers, although all the settings were still there. This helped:

Menu -> Help -> Troubleshoot mode

after it restarts in troubleshoot mode, go back to normal mode

Menu -> Help -> Turn Troubleshoot Mode off

It's still flashing, but with the color which set with "browser.display.background_color" parameter, which can be set in Settings, actually:

about:preferences#general -> Manage Colors -> background

However, I hate doing this dance on every machine I use

@jwinther95
Copy link

Works great with latest Firefox 122.0 - thank you :)!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment