Comment 45 for bug 27867

Revision history for this message
In , Florent (florent) wrote :

George: my point was not about users selecting black text and black background. My point was that the only way to respect the user’s choice of colors is disabling background images altogether.

And disabling background images will make some elements disappear because they have been coded as background images when they shouldn’t have been. (And it’s a bad practice that is, alas, VERY common in web pages — see Bug 1008583 for an example of this bad practice in Firefox itself.)

Let me explain how text and backgrounds are painted over a page or an area of a page. They are painted in three layers, from the top to the bottom:

1. Text and content images
2. Background image
3. Background color

If they are present, background images (which can be repeated as a pattern and cover a full page or area of a page) will be painted on top of the background color, hiding that background color.

Let's say a user defines their preferred color as text=black, background=white. Pretty straightforward.
Now let’s say a website defines colors like this for the main content of their pages:

1. Text = #A0A0A0 (a light gray)
2. Black or dark background image (e.g. http://subtlepatterns.com/txture/)
3. Background color = #101010 (almost black)

If we change the text and background color to the user’s preference, BUT keep the background image, we end up with:

1. Text = black
2. Black or dark background image
3. Background color = white

So we end up showing black text on a blackish background (the background image, which completely covers the background color). The white background color is not visible, and the text can’t be read.

Of course if the user chooses white text (and a black or dark background) it works in this case, but it will break on many other sites. Background images uses for decorative patterns, gradients and other effects are very common on the Web (though a bit less popular in webdesign in the past 2 years).

So Firefox has to disable background images for this feature (“Use my own colors”) to work. BUT bad web developers use background images when they shouldn’t (because in some cases it’s easier to do, and it even has some benefits for making websites speedier). So disabling background images makes some websites hard to use (e.g. disappearing buttons).

This can’t be fixed with a simple tweak of this feature. And it might not be possible to find a more elaborate solution (read: days or even weeks of developer time) that yields good results.