简体   繁体   English

如何更改Eclipse中自动完成框中的突出显示颜色

[英]How to change the highlight color in autocomplete box in Eclipse

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. 更改Ubuntu主题会更改此颜色。 There are settings about this in /usr/share/themes/Ambiance/ , but I can't figure out which one. /usr/share/themes/Ambiance/有关于此的设置,但我无法弄清楚哪一个。 The background is a gradient, so picking the color and grepping for it does not work. 背景是渐变,因此选择颜色并为其添加灰色不起作用。

it must be a system setting, try the Ubuntu control center (system settings) / appearance / customize. 它必须是系统设置,尝试Ubuntu控制中心(系统设置)/外观/自定义。 Click all the tabs and see which color matches the color in eclipse. 单击所有选项卡,查看哪个颜色与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, eg: 您需要根据需要进行更改,例如:

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. 更新2:这与其他评论者建议的略有相似,只是在另一个文件中。 I guess the difference is that will affect the system globally 我猜不同之处在于它将影响全球系统

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 eg: 和改变是你想要的,例如:

    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中描述的两个更改

This problem can also be fixed from within Eclipse, as is described in the blog post Fix Eclipse colours in ubuntu 12.04 . 这个问题也可以在Eclipse中修复,如ubuntu 12.04中的博客文章Fix Eclipse colors中所述

  1. Go into the Preferences (Window -> Preferences) 进入首选项(窗口 - >首选项)
  2. Choose General -> Appearance from the left menu 从左侧菜单中选择常规 - >外观
  3. Uncheck the checkbox Use mixed fonts and colours for labels 取消选中“ 为标签使用混合字体和颜色 ”复选框

Before 之前

日食中坏的彩色代码完成窗口

After

在此输入图像描述

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. 然后它工作。

How to change it for all Ubuntu themes 如何为所有Ubuntu主题更改它

On Ubuntu you can add a fix to the Appearance theme: 在Ubuntu上,您可以为Appearance主题添加修复:

  • Open a terminal ( CTRL + ALT + T ) 打开终端( CTRL + ALT + T
  • Create a new file with: gedit ~/.gtkrc-2.0 使用以下命令创建一个新文件: 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 ;) 在Eclipse中测试,希望您的内容辅助可读;)

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自定义。

如何在eclipse中更改内容辅助颜色

Alternatively you can update the variables at the top of the gtkrc file. 或者,您可以更新gtkrc文件顶部的变量。 For your particular problem it would be selected_fg_color, not tooltip_fg_color, for example, change it from white to black(#000000). 对于您的特定问题,它将是selected_fg_color,而不是tooltip_fg_color,例如,将其从白色更改为黑色(#000000)。 Here are my settings: 这是我的设置:

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"

This may looks easy seems. 这看起来似乎很容易。 That is change the color theme of eclipse. 那就是改变eclipse的颜色主题。 Windows-> Preference -> Appearance -> Color theme. Windows->首选项 - >外观 - >颜色主题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM