问题
I know there are several tips for changing the background color of tooltip windows in eclipse under linux (these windows have on some linux distribution per default a black background ...). Some of the things I have tried are:
https://askubuntu.com/questions/70599/how-to-change-tooltip-background-color-in-unity https://askubuntu.com/questions/1620/how-to-fix-unreadable-tooltips-in-eclipse-helios https://askubuntu.com/questions/35491/how-to-change-tooltips-background-color-in-xfce
I have tried that successfully with eclipse luna. But it seems nothing of that will work together with eclipse mars.
Anybody knows how can I change the background color of tooltips in eclipse mars under linux?
EDIT (2016-Apr-06)
Ok. Found out several things in last months. In eclipse Mars the developer switches on Linux from GTK2 to GTK3 . So there was several things changed in Mars. As I had written my question above I had work on XFCE. Now I have switched to KDE. On KDE I can change the tooltip background color like it was described in the comment of "omid" below. But also KDE has several problems with eclipse Mars. To solve this see also my other question/answer her:
https://stackoverflow.com/a/35897315/1465758
But I have found no way to change the Tooltip background color on XFCE. May be the same on Gnome (not tested by me)...
回答1:
First, create the file ~/.gtkrc-2.0.eclipse
with the following content:
style "eclipse-tooltips"
{
bg[NORMAL] = "#FFFFAF"
fg[NORMAL] = "#000000"
}
widget "gtk-tooltip*" style "eclipse-tooltips"
...and then run eclipse like this:
GTK2_RC_FILES=~/.gtkrc-2.0.eclipse SWT_GTK3=0 eclipse
(Found these instructions here: https://forum.xfce.org/viewtopic.php?pid=40119#p40119)
回答2:
Other answers appear to disable gtk3.
I was able to fix this issue in eclipse neon + linux mint 18 (sarah) without falling back to gtk2
The gtk3 theme files in /usr/share/themes/Mint-X-Teal/gtk-3.0 define what color to use for tooltips like so:
@define-color theme_tooltip_bg_color #fbeaa0;
@define-color theme_tooltip_fg_color #212121;
eclipse is looking for very similar settings, just without "theme_" in the name.
In linux mint 18 (sarah) or any other distro that uses gtk 3, you'll want to first make a copy of that file for safekeeping
sudo cp /usr/share/themes/Mint-X-Teal/gtk-3.0/gtk-main.css{,.bak}
then open the file for editing
sudo vim /usr/share/themes/Mint-X-Teal/gtk-3.0/gtk-main.css
or if you're not comfortable with vim
gksu gedit /usr/share/themes/Mint-X-Teal/gtk-3.0/gtk-main.css
and then add the following lines
@define-color tooltip_bg_color #ffffff;
@define-color tooltip_fg_color #212121;
But find an html color picker online and select colors you're comfortable with.
Note that you may have to edit files in a different directory based on what theme you're using. On linux mint 18 (sarah), this can be determined by opening the "themes" setting dialog and checking which one is used for "controls"
I use the "Mint-X-Teal" theme, but for the Mint-X theme you would look here
/usr/share/themes/Mint-X/gtk-3.0/gtk-main.css
来源:https://stackoverflow.com/questions/35082507/eclipse-mars-on-linux-black-background-color-in-tooltips