Change Firefox new tab background

22

10

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?

danicotra

Posted 2017-07-30T22:17:51.300

Reputation: 1 489

Dark theme for Firefox https://overdodactyl.github.io/ShadowFox/

– Josh Habdas – 2019-07-05T02:16:11.163

Answers

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_

danicotra

Posted 2017-07-30T22:17:51.300

Reputation: 1 489

3

For doing the same thing with Firefox about:blank page you can refer to this other Q&A: https://superuser.com/questions/603218/how-to-make-the-aboutblank-page-black-or-any-other-color-in-firefox

– danicotra – 2017-07-30T22:22:17.907

3Bonus points(if I could) for the Firefox 57+ compatible method. – japzone – 2017-11-17T06:44:07.793

Update-comment: Make sure you don't miss this new and awesome Firefox extension: Tabliss works great! (Available for Chrome as well)

– danicotra – 2018-06-24T21:34:48.897

Another good WebExtension for FF to achieve the purpose here: New Tab Override

– danicotra – 2018-06-27T18:34:55.633

Thanks! just made this to match breeze dark plasma 5 theme colors https://gitlab.com/snippets/1781039

– isalgueiro – 2018-11-20T12:49:58.703

1Doesn't work in Firefox 67 – Vladimir Jovanović – 2019-05-25T17:28:16.363

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

gagarine

Posted 2017-07-30T22:17:51.300

Reputation: 887

Doesn't work in Firefox 67 – Vladimir Jovanović – 2019-05-25T17:27:57.787

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 – 2019-06-28T05:38:32.757

1Works in Firefox 71 – Edwin – 2020-01-04T11:41:15.673

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;
}

psychoslave

Posted 2017-07-30T22:17:51.300

Reputation: 483

2

An almost working solution for blank flash https://www.reddit.com/r/firefox/comments/6s2l0w/removing_the_white_flash_before_a_page_loads/ but some white elements might still flash while loading page.

– psychoslave – 2017-11-21T21:47:52.567

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.

edison23

Posted 2017-07-30T22:17:51.300

Reputation: 121

-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; }

Szemes Erik

Posted 2017-07-30T22:17:51.300

Reputation: 1