changing highlight color

Cameron McCormack cam at
Fri Jul 17 09:38:42 UTC 2015

Pawel Por:
> When I highlight a block of text using mouse it usually makes a
> background color to become dark blue and a text color to become white.
> It happens in most cases when a web page has got originally a white
> background color.
> How can I customize a background color when highlighting a text with
> mouse. E.g. I would like it to be yellow.
> I'm sending this question to "dev" mailing list because I'm affraid
> that I need to modify the source code of a firefox for my needs to
> achieve this effect.
> If so could you please point me out to the location of a source code
> where I should look at.

I don’t think there is a pref for setting the highlight background and
foreground colour, but you can create a user style sheet that sets
it.  If you write this:

  ::-moz-selection {
    background-color: yellow !important;
    color: black !important;

and put it in a file named chrome/userContent.css in your profile
directory it should override the platform defaults and the selection
styling that comes from a web page.

See for more
information about userContent.css files.

Cameron McCormack ≝

More information about the firefox-dev mailing list