changing highlight color

Pawel Por porparek at
Mon Jul 27 07:39:38 UTC 2015

On Fri, Jul 17, 2015 at 11:38 AM, Cameron McCormack <cam at> wrote:
> 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 ≝

Thanks all of you for information.
It works like a charm :-) I still have one color to tune. When I
highlight a text on a web page with a mouse cursor it will get a color
just described in this thread (works great). Now question: when I
focus to another window that is smaller than firefox window the
highlighted color in firefox window changes. It becomes usually grey.
How can I force it not to change when I focus another window.

More information about the firefox-dev mailing list