Change GTK3 tooltip color only for Eclipse running

2019-09-12 00:14发布

问题:

I am running Eclipse Mars on Ubuntu 15.04. I have seen instructions to change GTK3 tooltip fg/bg color at system-wide level. My question is how can I change the GTK3 tooltip fg/bg color only for Eclipse without affecting other applications.

(GTK3 and CSS are not my fields of expertise so I really need some help here)

回答1:

I found a way to fix Eclipse tooltip color without falling back to GTK2 and without affecting any other application.

The fix is captured in a script and it can be accessed here.

https://github.com/KiranMohan/eclipse-gtk3-ubuntu

The script makes a copy of the Ambiance theme, modifies the tooltip color and then writes a launcher for eclipse with this new Theme.



回答2:

How to apply GTK changes only to eclipse:

Somewhere on your home directory, create a gtkrc file (like: ~/.gtkrc-eclipse) with following content:

gtk-color-scheme = "selected_bg_color:#0AFC02\nselected_fg_color:#FFFFFF\norginal_selected_bg_color:#f07746\ntooltip_bg_color:#f5f5c5\ntooltip_fg_color:#000000"

Launch eclipse from command line like,

env GTK2_RC_FILES=/usr/share/themes/<Your current theme>/gtk-2.0/gtkrc:/home/<user name>/.gtkrc-eclipse '

env GTK2_RC_FILES=/usr/share/themes/Ambiance/gtk-2.0/gtkrc:/home/chandrayya/.gtkrc-eclipse '/opt/eclipse-3.3/eclipse'

You can find out your current theme by executing,

gsettings get org.gnome.desktop.interface gtk-theme

Choose your fg/bg color code.

Also refer this post Change Eclipse sidebar vertical scope highlighting.