avp::ptr weblog

Everything that is in our mind.

How to fix Eclipse colors for autocompletion and tooltips

with 11 comments

Sadly Eclipse ships with a broken color theme when it comes to autocompletion and tooltips. I cannot tell if the problem is limited to Ubuntu Precise, however, it is worth getting fixed immediately. The following screenshots illustrate the broken color settings in both situations. The tooltip window shows up with a black background color and blue links.

Eclipse IDE - Tooltip with default colors settings

Eclipse – Tooltip with default colors settings

When autocompletion popup appears the first suggestions is not readable at all.

Eclipse IDE - Autocompletion with default colors settings

Eclipse – Autocompletion with default colors settings

So, here is what you need to do to fix the colors.

Fixing the color settings

Create configuration file in your HOME folder. The name is not essential, mine is named .gtkrc-eclipse

# Customs color settings for Eclipse.
# Load Eclipse as follows:
# GTK2_RC_FILES=~/.gtkrc-eclipse eclipse
# Sources:
# http://askubuntu.com/a/131348/18533
# http://stackoverflow.com/a/8063723/356895
# http://askubuntu.com/a/70964/18533

# Autocompletion background color.
style "eclipse-autocompletion" {
base[ACTIVE] = shade(0.7, "#F2F1F0")

# Tooltip background color.
style "eclipse-tooltips" {
bg[NORMAL] = "#e8e8e8"
fg[NORMAL] = "#000000"

# Load settings.
class "GtkTreeView" style "eclipse-autocompletion"
widget "gtk-tooltip*" style "eclipse-tooltips"

To load the settings whenever you launch Eclipse from the command line simple alias the original binary and pre-load the settings file.

alias eclipse='GTK2_RC_FILES=~/.gtkrc-eclipse eclipse'

Further, if you use the launcher within Ubuntu, you need to modify the .desktop file for Eclipse, too. You can find the file in ~/.local/share/applications.

$ /bin/bash -c "GTK2_RC_FILES=~/.gtkrc-eclipse eclipse"

When you are done and restart Eclipse the autocompletion and the tooltip should look similar to the following screenshots. I have chosen a light gray for the background color of the tooltip window. Feel free to customize the colors to your own taste.

Eclipse IDE - Tooltip with default colors settings

Eclipse – Tooltip with default colors settings

The first tooltip suggestion should be readable now.

Eclipse IDE - Autocompletion with fixed colors settings

Eclipse – autocompletion with fixed colors settings

I compiled this article from various sources which I like to add as a reference.

Written by tobi

July 28th, 2012 at 5:11 pm

11 Responses to 'How to fix Eclipse colors for autocompletion and tooltips'

Subscribe to comments with RSS or TrackBack to 'How to fix Eclipse colors for autocompletion and tooltips'.

  1. Thanks a lot! This saved me a lot of eyestrain. God alone knows what the Ubuntu maintainers are thinking messing with the colors like this.


    7 Sep 12 at 06:54

  2. Die Standardeinstellung im Ambiance-Theme sind kaum lesbar. Eine funktionierende Lösung habe ich hier: Eclipse-Aussehen unter Ubuntu verbessern


    8 Oct 12 at 10:15

  3. Thank you very much for this tip. It helped a lot and worked like charm. Great work!!


    16 Oct 12 at 09:57

  4. OMG thanks a milion !! Just spent 30mins looking for a solution to this !


    27 Oct 12 at 11:39

  5. Big thanks for this clear & perfect tutorial!


    26 Feb 13 at 13:07

  6. thanks a lot


    15 Mar 13 at 12:35

  7. thank you!!


    15 Apr 13 at 15:18

  8. thanks.


    15 Jun 13 at 22:25

  9. This works for me, but when i restart i need to run it from terminal.

    I put the /bin/bash -c “GTK2_RC_FILES=~/.gtkrc-eclipse eclipse” command in eclipse.desktop, but if the initial startup is not from terminal it wont change its background color.

    If i run it from terminal it works


    4 Feb 14 at 02:59

  10. Try adding /bin/bash -c "GTK2_RC_FILES=~/.gtkrc-eclipse eclipse" to the menu item entry of Eclipse. I recommend using alacarte for easy access.


    4 Feb 14 at 19:12

  11. This does not work for me. (Ubuntu 14.04, Eclipse Mars)


    15 Nov 15 at 13:54

Leave a Reply