如何获得黑暗主题的地址栏搜索结果

时间:2017-01-12 20:40:24

标签: css firefox firefox-addon firefox-developer-tools

我在MacOS上使用Firefox Developer Edition主题来减少编程时的眼睛疲劳。

但是,在位置栏中输入的结果仍然会弹出亮白色。

有没有人知道CSS会让这些结果使用深色背景和浅色文字?

enter image description here

2 个答案:

答案 0 :(得分:2)

通常,如果您正在寻找一个可以改变它的附加组件,那么主题将是合适的。我使用的至少一个主题确实为URL栏的自动完成结果设置了样式。如果需要,扩展名也可以更改样式。但是,鉴于您不想要一个完全不同的主题,只是对Developer Edition主题的一个小修改,通过将CSS放在 userChrome中将CSS应用到配置文件的chrome中,可以更容易地做到这一点。的CSS

要自己动手,你需要确定合适的样式元素。通常情况下,加载项DOM InspectorElement Inspector结合在确定样式的适当元素时非常有用。安装这些附加组件后,打开自动完成下拉列表和 Shift - 右键单击​​结果,看到DOM是否有我们想要更改的内容:

Image of DOM

因此,我们可以将以下内容放在配置文件 userChrome.css 中,该文件需要位于 [profile directory] ​​/ chrome 目录中:

/*
 * Edit this file and copy it as userChrome.css into your
 * profile-directory/chrome/
 */

/*
 * This file can be used to customize the look of Mozilla's user interface
 * You should consider using !important on rules which you want to
 * override default settings.
 */

/*
 * Do not remove the @namespace line -- it's required for correct functioning
 */
/* set default namespace to XUL */
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");

#PopupAutoCompleteRichResult {
    background-color:black !important;
    -moz-border-top-colors:black !important;
    -moz-border-top-colors:black !important;
    -moz-border-left-colors:black !important;
    -moz-border-right-colors:black !important;
}

#PopupAutoCompleteRichResult .autocomplete-richlistbox {
    background-color:black !important;
}

#PopupAutoCompleteRichResult .ac-title-text,
#PopupAutoCompleteRichResult .ac-tags-text,
/*#PopupAutoCompleteRichResult .ac-url-text,*/
#PopupAutoCompleteRichResult .ac-action-text {
    color:white;
}

这会导致网址栏自动完成,黑色背景为白色文字:

auto-complete with black background and white text

答案 1 :(得分:1)

好的,经过相当多的互联网挖掘后,我发现可能是唯一的解决方案,也不是真正的解决方案。

在撰写本文时,没有用于更改搜索栏样式的插件/插件/ Mod。 但是,您可以更改 Firefox 本身的源代码。为此,请从此处开始:Mozilla Dev GUide。它主要用 C &的 C++ 即可。我的意思是,真的没有选择。 有一些设置,在Firefox的某个深处,在那里你可以实际获得这样的附加组件,我无法找到它。 您可以完全关闭搜索栏,以便在点击输入后在谷歌上获得结果。

第三个选项是尝试其他浏览器。只需检查,哪个浏览器允许您设置搜索栏的样式,并稍后将所有其他黑暗主题应用于该浏览器。

希望,我没有让它变得更糟:/