I use a KDE theme with dark menus and white text. In Firefox (5.0), under Preferences->Content->Colors I have black text and a white background chosen. I have "use system colors" unchecked.

I encountered a site that specifies their CSS to set color: windowtext, but hardcodes the background to white. This results in white text on a white background. I don't understand why Firefox is using white text for windowtext.

How can I force Firefox to use a color of my choice when it resolves "windowtext"? Is there something I can put in userContent.css or userChrome.css? or some other way?

migrated from stackoverflow.com Jul 23 '11 at 19:48

This question came from our site for professional and enthusiast programmers.

  • What a strange site. – BoltClock Jul 22 '11 at 16:29

You can't tell Firefox to pick an arbitrary color to resolve to when encountering a system color. That's hardcoded into the rendering engine. However, you can still tell it to set the text black and the background white for that site.

Go to userContent.css and add the following style:

@-moz-document domain('offendingsite.com') {
    body {
        color: black !important;
        background-color: white !important;

Then restart Firefox and visit the site again.

Of course, offendingsite.com should be replaced with the domain name of the site in question.

  • This works, but there's two things I don't like about it: first, it requires me to solve it for every site I encounter whose CSS doesn't work for light-on-dark system themes, and second, once I put !important in, I take control away from the web site designer. I want them to be able to use colors of their choosing. I just don't want them to be able to mix those with colors of MY choosing (windowtext), especially because it sounds like I can't actually do the choosing at the browser level. – bwtaylor Jul 22 '11 at 18:58
  • @bwtaylor: Well, that's likely why the CSS3 Color Module deprecated system colors. – BoltClock Jul 22 '11 at 19:00
  • Hooray for that. It seems like a Firefox bug to use the system color when I unchecked "use system colors". In the particular site, they use color: windowtext to color links, so I modified your recommendation and changed "body" to "a" and it worked. – bwtaylor Jul 22 '11 at 19:15

well if you can get access to a user css file, you can set

  color: black !important
  background-color: white !important

I think that's the closest you can get with it though.

Your Answer

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