为提升您的使用体验,本站正在维护,部分功能暂时无法使用。如果本站文章无法解决您的问题,您想要向社区提问的话,请到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 提问,我们的支持社区将会很快回复您的疑问。

搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

Change the Findbar's search matches background / foreground color for the FOCUSED search match

  • 3 个回答
  • 1 人有此问题
  • 207 次查看
  • 最后回复者为 cor-el

more options

Apparently, the preference names for the currently selected / focused, highlighted search match have changed. I can't find any CSS code on the web to modify this behavior. Though I made a note years ago about switching from using prefs for it in about:config, to using a CSS style.

The "unfocused" highlighted search matches do allow me to change both FG & (BG=bright pink) colors - to a point. I think I had to create these prefs, or some of them. The UNfocused search matches color prefs are: ui.textHighlightBackground #EF0FFF ui.textHighlightForeground #000000

They allow me to use black (vs. default white) for the text color on the fuchsia BG.

The pref names for focused search match apparently changed, based on an old profile. ui.textSelectBackgroundAttention #00FF00 ui.textSelectForegroundAttention #FFFFFF (I can change the white FG to anything, but it always defaults to white. The green BG w/ white FG / text, is really hard for me to read.

Fx won't allow me to change the FG color on the currently focused / selected search match. No matter if I select a BG color that black - or many non-white Foreground colors have a much higher contrast values than the default green BG w/ white FG.

Even if the colors I try have a much higher contrast value than the green / white. http://snook.ca/technical/colour_contrast/colour.html#fg=B6C9D0,bg=0004FF

EXCEPT, for the focused / selected match, if I enter white or very light BG, the super smart code still uses white text, making it invisible. But it won't let me use green / black, or yell BG with Red or Blk FG.

I think this problem is because of some algorithm Mozilla uses to calculate contrast values, that obviously doesn't work very well. Anyone know of a way around this issue, or CSS code that might override Mozilla's contrast algorithm?

Apparently, the preference names for the currently selected / focused, highlighted search match have changed. I can't find any CSS code on the web to modify this behavior. Though I made a note years ago about switching from using prefs for it in about:config, to using a CSS style. The "unfocused" highlighted search matches do allow me to change both FG & (BG=bright pink) colors - to a point. I think I had to create these prefs, or some of them. The UNfocused search matches color prefs are: ui.textHighlightBackground #EF0FFF ui.textHighlightForeground #000000 They allow me to use black (vs. default white) for the text color on the fuchsia BG. The pref names for focused search match apparently changed, based on an old profile. ui.textSelectBackgroundAttention #00FF00 ui.textSelectForegroundAttention #FFFFFF (I can change the white FG to anything, but it always defaults to white. The green BG w/ white FG / text, is really hard for me to read. Fx won't allow me to change the FG color on the currently focused / selected search match. No matter if I select a BG color that black - or many non-white Foreground colors have a much higher contrast values than the default green BG w/ white FG. Even if the colors I try have a much higher contrast value than the green / white. http://snook.ca/technical/colour_contrast/colour.html#fg=B6C9D0,bg=0004FF EXCEPT, for the focused / selected match, if I enter white or very light BG, the super smart code still uses white text, making it invisible. But it won't let me use green / black, or yell BG with Red or Blk FG. I think this problem is because of some algorithm Mozilla uses to calculate contrast values, that obviously doesn't work very well. Anyone know of a way around this issue, or CSS code that might override Mozilla's contrast algorithm?

由JoeB于修改

所有回复 (3)

more options

Note that those prefs are for find as you type (FAYT).

See:

More 'ui' prefs you can look at:

ui.textBackground
ui.textForeground
ui.textSelectBackground
ui.textSelectForeground
ui.textSelectForegroundCustom
ui.textSelectBackgroundDisabled
ui.textSelectBackgroundAttention (background for FAYT)
ui.textHighlightBackground
ui.textHighlightForeground
more options

Thanks. I saw most of those (more than I wanted). What I need most is how to change the focused FG color of Findbar matches. If I make the focused BG really dark so the white text is more legible, then the current focused match is hard to locate. None of these or others I tried change the white, focused FG.

cor-el said

Note that those prefs are for find as you type (FAYT). See: More 'ui' prefs you can look at:
ui.textBackground
ui.textForeground
ui.textSelectBackground
ui.textSelectForeground
ui.textSelectForegroundCustom
ui.textSelectBackgroundDisabled
ui.textSelectBackgroundAttention (background for FAYT)
ui.textHighlightBackground
ui.textHighlightForeground

Note, which "those prefs" do you mean? Besided, in Linux, if you enable "search for text when you type," when you start typing, the Findbar pops up. So they're really colors for Findbar.

If some prefs you mean include: ui.text*... : ...HighlightBackground(or Foreground), ...SelectBackgroundAttention,

they may have dual purpose - if you want to call it that. I guarantee, they are the colors for matches of terms entered into Findbar (Ctrl F on most systems & Linux).

The prefs "ui.textHighlightBackground (or Foreground) control the findbar UNfocused matches. "ui.textSelectBackgroundAttention" changes the Findbar FOCUSED match BG color. To any focused BG color you want - as long as you like a white FG with it.

I still haven't found how to change the currently focused foreground (text) color of Findbar's match. The focused FG color ALWAYS defaults to white, no matter what the BG.

Sometimes, Firefox "flips" the colors specified for focused FG & BG of matches.

I believe it's hardcoded to use white on focused matches. Nothing I've read or tried said how to override the white focused FG for Findbar match - not with prefs or CSS.

As said, it's not coded well enough, to use a FG other than white if a light BG is entered for focused findbar match. It makes text on focused matches invisible.

Don't try using something like yellow BG & red FG for focused match colors (or any high contrast, high visibility duo) - it won't allow it. It switches the red FG to white. This has been a puzzler? / irritant? for many years.

more options

Your question post mentions these two prefs and I meant to refer to those two:

  • ui.textSelectBackgroundAttention #00FF00

This pref isn't present in the source code, so it shouldn't be a surprise that this doesn't work.

You can see all supported ui prefs on this page and possible do a search :