41

I can't find a way to change the color of the highlighted selection in the autocomplete box in Eclipse.

enter image description here

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


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.

Emil Ivanov
  • 37,300
  • 12
  • 75
  • 90
  • @Polynomial: Question updated. – Emil Ivanov Nov 04 '11 at 16:04
  • 1
    There is a duplicate on ask ubuntu http://askubuntu.com/questions/62421/eclipse-content-assist-popup-is-unreadable-on-ambiance-radiance-theme – Eero Aaltonen Aug 30 '12 at 12:40
  • possible duplicate of [The selected entry in Eclipse content assist is unreadable because of colours](http://stackoverflow.com/questions/6424800/the-selected-entry-in-eclipse-content-assist-is-unreadable-because-of-colours) – Chandrayya G K Aug 13 '14 at 13:32
  • 1
    would be great to know how it is done in windows too - i am suffering hard here ... – thedrs Dec 10 '15 at 13:23

7 Answers7

40

This problem can also be fixed from within Eclipse, as is described in the blog post Fix Eclipse colours in ubuntu 12.04.

  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

the bad colored code completion window in eclipse

After

enter image description here

Konrad Reiche
  • 27,743
  • 15
  • 106
  • 143
39

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.

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

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

in my version line 94 is

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.

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

UPDATE 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)

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 :

In ubuntu 12.04 you need to do both changes described in update 1 and update 2

Peter Szanto
  • 7,568
  • 2
  • 51
  • 53
8

for Ubuntu 12.04, simply edit the file /usr/share/themes/Ambiance/gtk-2.0/gtkrc search for

  base[ACTIVE]      = shade (0.94, @bg_color)

change the shade percentage from 0.94 to whatever visible like 0.54

  base[ACTIVE]      = shade (0.54, @bg_color)

then it works.

Neil
  • 54,642
  • 8
  • 60
  • 72
Ethan Song
  • 81
  • 1
  • 2
  • Thank you! I have been looking for a solution to this for 30 minutes, and this is the first one that actually worked. – Jeff Hillman May 04 '12 at 21:40
  • Works nicely for the default Ambiance theme indeed. Of course, the reference to Ambiance in the path name should have told me that this has no effect on Radiance, which has its own folder in `/usr/share/themes`. ;-) – Arjan Sep 10 '12 at 12:02
5

How to change it for all Ubuntu themes

On Ubuntu you can add a fix to the Appearance theme:

  • 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 ;)
Jason Plank
  • 2,336
  • 5
  • 31
  • 40
  • Here is the setup on how to **load settings only for Eclipse** and also **customize the tooltips**: http://askubuntu.com/a/131348/18533 – JJD Jun 23 '12 at 10:10
  • 1
    I compiled an [article](http://weblog.avp-ptr.de/20120728/how-to-fix-eclipse-colors-for-autocompletion-and-tooltips/) which summarizes the topic. – JJD Jul 28 '12 at 15:20
3

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.

how to change the content assist color in eclipse

Joel Christophel
  • 2,604
  • 4
  • 30
  • 49
thewhitetulip
  • 3,235
  • 3
  • 21
  • 26
2

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:

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"
Andrew Nguyen
  • 591
  • 6
  • 13
  • Tooltip Color is another topic. This is not working for me. Instead Just put this into the ~/.gtkrc-2.0 if you don't want to change system theme files: `style "eclipse-fix" { bg[NORMAL] = "#cccccc" fg[NORMAL] = "#000000" bg[SELECTED] = "#cccccc" } widget "gtk-tooltip*" style "eclipse-fix" ` – eldiamo Aug 24 '13 at 23:56
0

This may looks easy seems. That is change the color theme of eclipse. Windows-> Preference -> Appearance -> Color theme.

Photon001
  • 145
  • 9