如何更改 Eclipse 中自动完成框中的突出显示颜色
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8012176/
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
How to change the highlight color in autocomplete box in Eclipse
提问by Emil Ivanov
I can't find a way to change the color of the highlighted selection in the autocomplete box in Eclipse.
我找不到更改 Eclipse 自动完成框中突出显示选择的颜色的方法。
As you can see from the screenshot white text on light gray background is not very readable.
从截图中可以看出,浅灰色背景上的白色文本可读性不是很好。
Ubuntu 11.10 with Unity and Eclipse Classic
带有 Unity 和 Eclipse Classic 的 Ubuntu 11.10
Update:This is system dependent, indeed. Changing the Ubuntu theme changes this color. There are settings about this in /usr/share/themes/Ambiance/
, but I can't figure out which one. The background is a gradient, so picking the color and grepping for it does not work.
更新:这确实取决于系统。更改 Ubuntu 主题会更改此颜色。中有关于此的设置/usr/share/themes/Ambiance/
,但我不知道是哪一个。背景是渐变的,因此选择颜色并对其进行搜索是行不通的。
采纳答案by Peter Szanto
it must be a system setting, try the Ubuntu control center (system settings) / appearance / customize. Click all the tabs and see which color matches the color in eclipse.
一定是系统设置,试试Ubuntu控制中心(系统设置)/外观/自定义。单击所有选项卡,查看哪种颜色与 eclipse 中的颜色匹配。
Update:I just realized that in ubuntu 11.04 for some weird reason the possibility to customize the colors was removed, you need to change the config files
更新:我刚刚意识到在 ubuntu 11.04 中出于某种奇怪的原因,自定义颜色的可能性被删除了,您需要更改配置文件
sudo vim /usr/share/themes/Ambiance/gtk-2.0/gtkrc
in my version line 94 is
在我的版本第 94 行是
base[ACTIVE] = shade (0.97, @bg_color)
which you need to change as you wish, e.g.:
您需要根据需要进行更改,例如:
base[ACTIVE] = shade (0.50, @bg_color)
then you go to System settings / appearance, change the theme to something then change back to Ambience and voila, things are changed. I just can't imagine why there is no UI for changing this.
然后您转到系统设置/外观,将主题更改为某些内容,然后更改回氛围,瞧,事情发生了变化。我只是无法想象为什么没有用于更改此设置的 UI。
Update 2: this is slightly similar to what the other commenter suggested, just in a different file. I guess the difference is that will affect the system globally
更新 2:这与其他评论者的建议略有相似,只是在不同的文件中。我想不同之处在于会在全局范围内影响系统
UPDATE 2 :
更新 2:
in ubuntu 11.10 there is still no GUI to change the theme colors, but they also changed the file structure so exectute the following command (same as above)
在 ubuntu 11.10 中仍然没有 GUI 来更改主题颜色,但他们也更改了文件结构,因此执行以下命令(同上)
sudo vim /usr/share/themes/Ambiance/gtk-2.0/gtkrc
and search for this section that controls tooltip colors :
并搜索控制工具提示颜色的部分:
style "tooltips" {
bg[NORMAL] = @tooltip_bg_color
fg[NORMAL] = @tooltip_fg_color
}
and alter is as you wish e.g.:
和改变如你所愿,例如:
bg[NORMAL] = "#000000"
fg[NORMAL] = "#FFFFFF"
UPDATE 3 :
更新 3:
In ubuntu 12.04 you need to do both changes described in update 1 and update 2
在 ubuntu 12.04 中,您需要进行更新 1 和更新 2 中描述的更改
回答by Konrad Reiche
This problem can also be fixed from within Eclipse, as is described in the blog post Fix Eclipse colours in ubuntu 12.04.
这个问题也可以在 Eclipse 中修复,如博客文章Fix Eclipse colors in ubuntu 12.04 中所述。
- Go into the Preferences (Window -> Preferences)
- Choose General -> Appearance from the left menu
- Uncheck the checkbox Use mixed fonts and colours for labels
- 进入首选项(窗口 -> 首选项)
- 从左侧菜单中选择“常规”->“外观”
- 取消选中对标签使用混合字体和颜色复选框
Before
前
After
后
回答by Ethan Song
for Ubuntu 12.04, simply edit the file /usr/share/themes/Ambiance/gtk-2.0/gtkrc
search for
对于 Ubuntu 12.04,只需编辑文件/usr/share/themes/Ambiance/gtk-2.0/gtkrc
搜索
base[ACTIVE] = shade (0.94, @bg_color)
change the shade percentage from 0.94 to whatever visible like 0.54
将阴影百分比从 0.94 更改为任何可见的,例如 0.54
base[ACTIVE] = shade (0.54, @bg_color)
then it works.
那么它的工作原理。
回答by Ethan Song
How to change it for all Ubuntu themes
如何为所有 Ubuntu 主题更改它
On Ubuntu you can add a fix to the Appearance theme:
在 Ubuntu 上,您可以为外观主题添加修复程序:
- Open a terminal ( CTRL+ ALT+ T)
- Create a new file with:
gedit ~/.gtkrc-2.0
In that file add these lines:
style "eclipse_fix" { base[ACTIVE] = shade(0.7, "#F2F1F0") } class "GtkTreeView" style "eclipse_fix"
Save file
- In System Settings > Appearance, switch to an other theme and then switch back to the theme you had. This is done to "refresh" the current theme with the fix. (Alternatively, log out and log in again.)
- Test in Eclipse, hopefully your content assist will be readable ;)
- 打开终端 ( CTRL+ ALT+ T)
- 使用以下命令创建一个新文件:
gedit ~/.gtkrc-2.0
在该文件中添加以下几行:
style "eclipse_fix" { base[ACTIVE] = shade(0.7, "#F2F1F0") } class "GtkTreeView" style "eclipse_fix"
保存存档
- 在系统设置 > 外观中,切换到其他主题,然后切换回您拥有的主题。这样做是为了使用修复程序“刷新”当前主题。(或者,注销并重新登录。)
- 在 Eclipse 中进行测试,希望您的内容帮助是可读的;)
回答by Andrew Nguyen
Alternatively you can update the variables at the top of the gtkrc file. For your particular problem it would be selected_fg_color, not tooltip_fg_color, for example, change it from white to black(#000000). Here are my settings:
或者,您可以更新 gtkrc 文件顶部的变量。对于您的特定问题,它将是 selected_fg_color,而不是 tooltip_fg_color,例如,将其从白色更改为黑色 (#000000)。这是我的设置:
gtk-color-scheme = "base_color:#ffffff\nfg_color:#4c4c4c\ntooltip_fg_color:#000000\n
selected_bg_color:#f07746\nselected_fg_color:#000000\n
text_color:#3C3C3C\nbg_color:#F2F1F0\ntooltip_bg_color:#FFFFFF\nlink_color:#DD4814"
回答by thewhitetulip
You do not need to use the command prompt at all.
您根本不需要使用命令提示符。
Window -> Preferences -> General -> Appearance -> Colors and Fonts -> Basic -> Content Assist background color / Content Assist foreground color
窗口 -> 首选项 -> 通用 -> 外观 -> 颜色和字体 -> 基本 -> 内容辅助背景色/内容辅助前景色
Everything is customizable via the GUI.
一切都可以通过 GUI 自定义。
回答by Photon001
This may looks easy seems. That is change the color theme of eclipse. Windows-> Preference -> Appearance -> Color theme.
这看起来似乎很容易。那就是改变eclipse的颜色主题。Windows-> 首选项 -> 外观 -> 颜色主题。