Eclipse,将鼠标悬停在关键字上时更改弹出文本背景颜色

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3571850/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 19:35:41  来源:igfitidea点击:

Eclipse, change popup text background color when hovering the mouse on a keyword

eclipseubuntu-10.04

提问by e2-e4

Ubuntu 10.04.1 new theme has by default all windows background colors set to black.
I don't want to change that.

Ubuntu 10.04.1 新主题默认将所有窗口背景颜色设置为黑色。
我不想改变这一点。

In Eclipse, the interface didn't change much due to 10.04.1 - except for one annoying thing:
when the mouse hovers over a keyword - a variable for instance - the type (...) of that keyword is displayed in a small pop-up window.
The problem since 10.04.1, is that the text is in blackcolor while the background is alsoblack.

在 Eclipse 中,由于 10.04.1,界面没有太大变化 - 除了一件烦人的事情:
当鼠标悬停在一个关键字上时 - 例如一个变量 - 该关键字的类型 (...) 显示在一个小的弹出窗口。
自 10.04.1 以来的问题是文本是黑色的,而背景也是黑色的。

Is there a way to change that background color in Eclipse?

有没有办法在 Eclipse 中更改该背景颜色?

回答by VonC

Update Dec. 2018: as mentioned in howlger's answer, Eclipse Oxygen 4.7 (June 2017)does now include a way to configure the background color in popups:

2018 年 12 月更新:如howlger回答中所述Eclipse Oxygen 4.7(2017 年 6 月)现在确实包含一种在弹出窗口中配置背景颜色的方法:

See "Colors in interactive popups"

请参阅“交互式弹出窗口中的颜色

Interactive popups like JDT's Quick Outline don't use the platform's tooltip colors any more, since those were sometimes hard to read.

像 JDT 的 Quick Outline 这样的交互式弹出窗口不再使用平台的工具提示颜色,因为它们有时难以阅读。

Old style:

老款式:

https://www.eclipse.org/eclipse/news/4.7/images/old-popup-color-constants.png

https://www.eclipse.org/eclipse/news/4.7/images/old-popup-color-constants.png

New style:

新风格:

https://www.eclipse.org/eclipse/news/4.7/images/new-popup-color-constants.png

https://www.eclipse.org/eclipse/news/4.7/images/new-popup-color-constants.png

  • Go to Window > Preferences: General > Appearance > Colors and Fonts
  • and change the Basic > Information backgroundcolor.
  • Window > Preferences: General > Appearance > Colors and Fonts
  • 并改变Basic > Information background颜色。

In that same Colors and Fontssection, you will find:

在同Colors and Fonts一部分,您会发现:

  • Code assist

    • Basic > Content Assist background color-> change
    • Basic > Content Assist foreground color-> change
  • java doc

    • Java > Javadoc background( overrides default: information background color) -> change
  • 代码辅助

    • Basic > Content Assist background color-> 改变
    • Basic > Content Assist foreground color-> 改变
  • 文档

    • Java > Javadoc background(覆盖默认值:信息背景颜色)-> 更改


Original answer (2010-2012)

原始答案(2010-2012)

All the various popup background color are managed in Preferences > Java > Editor(like the one for the completion list popup in bug 133615).
Other background colors are in General > Appearance > Colors and Font(type backgroundin the filter field).

所有各种弹出式背景颜色都在Preferences > Java > Editor其中进行管理(例如bug 133615 中的完成列表弹出式背景颜色)。
其他背景颜色在General > Appearance > Colors and Fontbackground在过滤器字段中输入)。

But the type popup seems to stick to a system color, which is why you see a black background.
If this is truly the case, it is worth reporting as a bug.

但是类型弹出窗口似乎坚持系统颜色,这就是您看到黑色背景的原因。
如果情况确实如此,则值得报告为错误。



The OP confirms it is not the case, actually:

OP 确认事实并非如此,实际上:

It was in Preferences > C/C++ > Editor > Source hover background, and had to untick the "System default" (because the shown color was light-gray!)

它在 中Preferences > C/C++ > Editor > Source hover background,并且必须取消勾选“系统默认值”(因为显示的颜色是浅灰色!)



On Ubuntu 12.04+, the post "How to change tooltip background color in Unity?" also mentions:

在 Ubuntu 12.04+ 上,帖子“如何在 Unity 中更改工具提示背景颜色?”还提到:

/usr/share/themes/Ambiance/gtk-2.0/gtkrc

The recent post (December 2012) "Eclipse Papercut #10 – Eclipse on Ubuntu: Fixing the black background color in hover" (from Lars Vogel) confirms:

最近的帖子(2012 年 12 月)“ Eclipse Papercut #10 – Ubuntu 上的 Eclipse:在悬停中修复黑色背景色”(来自Lars Vogel)证实:

The relevant properties are tooltip_fg_colorand tooltip_bg_color.
Just search for these values, the position changes sometimes between releases, currently they are at the very top of the file.

The following setting uses more reasonable colors.

相关属性是tooltip_fg_colortooltip_bg_color
只需搜索这些值,位置有时会在版本之间发生变化,目前它们位于文件的最顶部。

下面的设置使用了更合理的颜色。

tooltip_fg_color:#000000
tooltip_bg_color:#f5f5c5


pointhiadds in the comments:

pointhi在评论中补充道:

I also had to set the environment variable SWT_GTK3=0before starting eclipse to get it working.

我还必须SWT_GTK3=0在启动 eclipse 之前设置环境变量才能使其工作。

回答by marc

If you use KDE (Kubuntu) you can fix that by changing the Tooltip Background color in KDE System Settings -> Application Appearance -> Colors -> Colors, and change the Tooltip Background.

如果您使用 KDE (Kubuntu),您可以通过在 KDE 系统设置 -> 应用程序外观 -> 颜色 -> 颜色中更改工具提示背景颜色并更改工具提示背景来解决该问题。

回答by Mike

I've adopted a slightly different solution;

我采用了一个稍微不同的解决方案;

First create a new script, eclipse.sh, that starts eclipse, mine look like this:

首先创建一个新脚本 eclipse.sh,它启动 eclipse,我的看起来像这样:

#!/bin/bash
GTK2_RC_FILES=/usr/share/eclipse/gtkrc-2.0-eclipse /usr/share/eclipse/eclipse

Then create the gtkrc file (/usr/share/eclipse/gtkrc-2.0-eclipse), mine look like this (it have some other changes as well to make better use of the screen):

然后创建 gtkrc 文件(/usr/share/eclipse/gtkrc-2.0-eclipse),我的看起来像这样(它还有一些其他更改以更好地利用屏幕):

style "my-tooltips"
{
  bg[NORMAL] = "#FFFFAF"
  fg[NORMAL] = "#000000"
}
widget "gtk-tooltip*" style "my-tooltips"

style "gtkcompact" 
{
    font_name="Ubuntu Light 11"

    GtkButton::default_border={0,0,0,0}
    GtkButton::default_outside_border={0,0,0,0}
    GtkButtonBox::child_min_width=0
    GtkButtonBox::child_min_heigth=0
    GtkButtonBox::child_internal_pad_x=4
    GtkButtonBox::child_internal_pad_y=4
    GtkMenu::vertical-padding=1
    GtkMenuBar::internal_padding=0
    GtkMenuItem::horizontal_padding=4
    GtkToolbar::internal-padding=1
    GtkToolbar::space-size=1
    GtkOptionMenu::indicator_size=0
    GtkOptionMenu::indicator_spacing=0
    GtkPaned::handle_size=4
    GtkRange::trough_border=0
    GtkRange::stepper_spacing=0
    GtkScale::value_spacing=0
    GtkScrolledWindow::scrollbar_spacing=0
    GtkExpander::expander_size=10
    GtkExpander::expander_spacing=0
    GtkTreeView::vertical-separator=0
    GtkTreeView::horizontal-separator=0
    GtkTreeView::expander-size=10
    GtkTreeView::fixed-height-mode=TRUE
    GtkWidget::focus_padding=0
    GtkTreeView::vertical-separator = 0
}

class "GtkWidget" style "gtkcompact"

style "gtkcompactextra" 
{
    xthickness=0
    ythickness=0
}

class "GtkButton"   style "gtkcompactextra"
class "GtkToolbar"  style "gtkcompactextra"
class "GtkPaned"    style "gtkcompactextra"
class "GtkNotebook" style "gtkcompact"

回答by Александр Аверьянов

window -> preferences -> general -> Appearance -> Color&Fonts -> Java (necessary language, example java) -> Javadoc text color (or Javadoc background)

窗口 -> 首选项 -> 常规 -> 外观 -> 颜色&字体 -> Java(必要语言,示例 java) -> Javadoc 文本颜色(或 Javadoc 背景)

回答by howlger

Since Eclipse Oxygen (4.7) this color can be configured in Window > Preferences: General > Appearance > Colors and Fontsby changing the Basic > Information background color.

从 Eclipse Oxygen (4.7) 开始,可以通过更改Basic > Information background colorWindow > Preferences: General > Appearance > Colors and Fonts 中配置这种颜色