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

5

54

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

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 black color while the background is also black.

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

Forgave answered 26/8, 2010 at 3:31 Comment(1)
askubuntu.com/questions/70599/…Aisne
E
82

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:

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.

Old style:

https://static.mcmap.net/file/mcmap/ZG-AbGLDKwf1c1bQXVMsZ7BxXS2vbmb/eclipse/news/4.7/images/old-popup-color-constants.png

New style:

https://static.mcmap.net/file/mcmap/ZG-AbGLDKwf1c1bQXVMsZ7BxXS2vbmb/eclipse/news/4.7/images/new-popup-color-constants.png

  • Go to Window > Preferences: General > Appearance > Colors and Fonts
  • and change the Basic > Information background color.

In that same Colors and Fonts section, you will find:

  • 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

Original answer (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 background in the filter field).

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:

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


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

/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:

The relevant properties are tooltip_fg_color and 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_color:#000000
tooltip_bg_color:#f5f5c5

pointhi adds in the comments:

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

Erubescence answered 26/8, 2010 at 4:17 Comment(4)
Thanks. Don't know why I didn't find that after searching for a to-the-nerves time... It was in Preferences > C/C++ > Editor > Source hover background, and had to untick the "System default" (because the shown color was light-gray!)Anisole
Filter for "background" and go to C++ > Editor. Then Look under the list marked "Appearance color options" There you will find "Source hover background"Crossopterygian
I also had to set the enviroment variable SWT_GTK3=0 before starting eclipse to get it working.Glottal
Since Eclipse Oxygen (4.7) this color can be configured: see my answerDisepalous
N
11

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.

Numbat answered 15/2, 2014 at 22:36 Comment(4)
+1 for Ubuntu Mint. Under colors select the 'tooltip' colorset and then change the 'inactive text'.Efferent
Sorry, 'Normal Background', not 'inactive text'. And you may or may not have to reload your workspace, which threw me off. Missed my 5 minute window to edit my comment.Efferent
Changing the tooltip background color did not work for me on KDE for CentOS 7. It remained black, even after restarting Eclipse Neon .2.Austral
Worked for me on KDE Neon 5.12 after restarting Nsight Eclipse.Strictly
B
6

I've adopted a slightly different solution;

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

#!/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):

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"
Buy answered 20/8, 2013 at 13:11 Comment(2)
What do I do if I don't have root access?Artist
This is the only solution that works, when --launcher.GTK_version 2 is set in eclipse.ini P.S. And yes, problem still present in Eclipse Neon.1Breeding
H
2

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

Hulton answered 7/9, 2017 at 13:4 Comment(0)
D
2

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

Disepalous answered 30/12, 2018 at 22:5 Comment(1)
Thank you (and +1). I have referenced your answer in mine, as well as added links and references.Erubescence

© 2022 - 2024 — McMap. All rights reserved.