22

I always use dark personas theme or the default compact dark theme that comes included with Firefox and I don't like the default background color being white when I open a new tab. There was an add on I used that let me customize new tabs but it's gone now with Firefox 57...

So, how can I do to change new tabs background?

28

I think this may interest others as well. So far I know a couple of addons to achieve that and a way to do without addons (as it seems a lot of them are disappearing day by day), here we go then:

  1. Customize about:newtab (please see point 3 below)

    This is a specific add on for the task, it not only let's you change the background color but also choose a background image and also resize and align it as you like... nice!

  2. Stylish (please see point 3 below)

    Stylish is an add on with a broader spectrum of functionality; it lets you customize Firefox itself as long as manage/install themes and skins for lots of popular websites such as Google, Facebook, YouTube and many others... I think it's overkill if you only need it for the task we are dealing with here.

  3. Neither of the above will work with Firefox 57 due to added restrictions. Stylus with Firefox 57's new tab page shows this message:

    As a security precaution, the browser prohibits extensions from affecting its built-in pages (like chrome://version, the standard new tab page as of Chrome 61, about:addons, and so on) as well as other extensions' pages. Each browser also restricts access to its own extensions gallery (like Chrome Web Store or AMO).

    So, let's leave addons aside and get our hands dirty!

    You may decide you don't want to use an addon for this, well in this case here's what to do:

    • write about:profiles in the Firefox address bar and select Open Folder in correspondence of the "Root Directory" of the user profile you want to customize (usually there's only one);

    • by now the profile's root folder should have opened, create (if it is not present yet) a new folder named chrome;

    • create (if it is not present already) a new file named userContent.css inside the chrome folder and put the following code in it:

      @-moz-document url("about:newtab") {  
          body {
              background-color: #000000 !important;
          }
      }
      

    If you can juggle with CSS, you may also add some code to set a background image if you like (I suggest to eventually put the images in the same folder with the CSS).

    You may need to restart Firefox to make customization being applied.

    Credits for this last point goes to DIENER_

  • 3
    For doing the same thing with Firefox about:blank page you can refer to this other Q&A: superuser.com/questions/603218/… – danicotra Jul 30 '17 at 22:22
  • 3
    Bonus points(if I could) for the Firefox 57+ compatible method. – japzone Nov 17 '17 at 6:44
  • Update-comment: Make sure you don't miss this new and awesome Firefox extension: Tabliss works great! (Available for Chrome as well) – danicotra Jun 24 '18 at 21:34
  • Another good WebExtension for FF to achieve the purpose here: New Tab Override – danicotra Jun 27 '18 at 18:34
  • 1
    Doesn't work in Firefox 67 – Vladimir Jovanović May 25 '19 at 17:28
7

Open about:config and change the value browser.display.background_color to the color of your choice. I'm using #595959 (neutral gray).

This works with blank tab or "Firefox Home".

Sadly, opening tab quickly or when the browser is on heavy load will still result of a white flash.

If you don't know how to use about:config please read https://support.mozilla.org/en-US/kb/about-config-editor-firefox

  • Doesn't work in Firefox 67 – Vladimir Jovanović May 25 '19 at 17:27
  • This does work for me on Firefox 67.0.4 (64-bit) on Arch Linux. However, the solution is not ideal due to the white flash, as described in the answer. – Casey Jones Jun 28 '19 at 5:38
  • 1
    Works in Firefox 71 – Edwin Jan 4 at 11:41
2

Well, I must say the solution given by @danicotra does work for new tab, even with Firefox 57. However, during loading of a page, a blank flash will still systematically burn your eyes.

Here is an other proposal of content for your ~/.mozilla/firefox/xxxxxxxx.default/chrome/userContent.css, which does darken a few more places, but won't resolve the blank flash on load.

/* https://userstyles.org/styles/90565/firefox-adjust-white-flash-when-opening-new-tab */
/* https://userstyles.org/styles/142191/remove-new-tab-flash */
@-moz-document url-prefix(about:preferences), url-prefix(about:blank), url-prefix(about:newtab) {
  html, body, #newtab-customize-overlay {
    background: #303030 !important;
    color: #b2b2b2 !important;
  } 
}

@-moz-document url(chrome://browser/content/browser.xul)
{

  browser[type="content-primary"]
  {
    background: #303030 !important;
    color: #b2b2b2 !important;
  }
}

@-moz-document url(chrome://browser/content/browser.xul)
{

  browser[type="content-primary"], tabbrowser tabpanels, #appcontent > #content
  {
    background: #1B1B1B url("chrome://global/skin/media/imagedoc-darknoise.png") repeat fixed !important;
    color: #b2b2b2 !important;
  }
}

@-moz-document url(about:blank),
               url(about:preferences),
               url(about:config),
               url(about:newtab)
{
  #newtab-window,
  html,
  body, 
  #newtab-customize-overlay 
  {
    background: #1B1B1B url("chrome://global/skin/media/imagedoc-darknoise.png") repeat fixed;
    color: #b2b2b2 !important;
  }
}

html>body {
  background: #303030 !important;
  color: #b2b2b2 !important;
}
0

OK, based on the answers from psychoslave and danicotra, I figured out a solution that works for me (my goal was to have a background image on the new tab page which I have set to about:blank). psychoslave's solution changes basically every Firefox's page which I don't want to but thanks to the beginning of his code I was able to figure out there are the url-prefix parts which make the whole thing apparently possible.

Note: For just a background color on new tab, open about:config, search for browser.display.background_color update its value with hex color code and you can drop this altogether.

  1. Find your profile root folder in about:profiles.
  2. Create a folder named chrome in your profile root.
  3. Create userContent.css with this content:
    /* https://userstyles.org/styles/90565/firefox-adjust-white-flash-when-opening-new-tab */
    /* https://userstyles.org/styles/142191/remove-new-tab-flash */
    @-moz-document url-prefix(about:blank), url-prefix(about:newtab) {
      html, body, #newtab-customize-overlay {
        background: url("konachan-steins-gate-s.jpg") no-repeat center center fixed !important; 
        background-size: cover !important;
      } 
    }
    
  4. Copy the image right next to the userContent.css file (FF didn't take any absolute paths elsewhere for me).
  5. In about:config, set toolkit.legacyUserProfileCustomizations.stylesheets to true so FF actually allows this customization.
  6. Restart your Firefox for the changes to take effect.

I confirm this works on Windows 10, Ubuntu and Xubuntu; Firefox 72.0.2, 73.0.

A big thanks to the other contributors mentioned above and to this thread on Reddit.

-1

I like psychoslave's option but if u do not want to change the google background or those sites background what use the browser default background change the last three line like this:

#root{   background: #303030 !important;   color: #b2b2b2 !important; } 

And here is the full code, copyed from psychoslave's answer.

>     /* https://userstyles.org/styles/90565/firefox-adjust-white-flash-when-opening-new-tab
> */ /* https://userstyles.org/styles/142191/remove-new-tab-flash */ @-moz-document url-prefix(about:preferences), url-prefix(about:blank),
> url-prefix(about:newtab) {   html, body, #newtab-customize-overlay {
>     background: #303030 !important;
>     color: #b2b2b2 !important;   }  }
> 
> @-moz-document url(chrome://browser/content/browser.xul) {
> 
>   browser[type="content-primary"]   {
>     background: #303030 !important;
>     color: #b2b2b2 !important;   } }
> 
> @-moz-document url(chrome://browser/content/browser.xul) {
> 
>   browser[type="content-primary"], tabbrowser tabpanels, #appcontent >
> #content   {
>     background: #1B1B1B url("chrome://global/skin/media/imagedoc-darknoise.png") repeat fixed
> !important;
>     color: #b2b2b2 !important;   } }
> 
> @-moz-document url(about:blank),
>                url(about:preferences),
>                url(about:config),
>                url(about:newtab) {   #newtab-window,   html,   body,    #newtab-customize-overlay    {
>     background: #1B1B1B url("chrome://global/skin/media/imagedoc-darknoise.png") repeat fixed;
>     color: #b2b2b2 !important;   } }
> 
> #root {   background: #303030 !important;   color: #b2b2b2 !important; }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.