1

I am using Ubuntu Mate 20.04 How can I customize the appearance (i.e. background, font color... ) of tooltips?
Maybe through dconf-editor or command line?

obaino
  • 328

1 Answers1

2

You can install Gtk2 and Gtk3 themes and most of them has a structure like this :

$tree . -d
.
├── assets
├── gnome-shell
│   └── assets
├── gtk-2.0
│   ├── apps
│   └── assets
├── gtk-3.0
├── metacity-1
└── xfwm4

In the gtk-3.0 directory you can find a file named gtk.css . Open it with your favorite text editor and search for ToolTips. There should be some properties like this :

tooltip {
   padding: 4px;
   /* not working */
   border-radius: 5px;
   box-shadow: none;
   text-shadow: 0 1px black; 
}

tooltip.background {
   background-color: rgba(0, 0, 0, 0.8);
   background-clip: padding-box;
   border: 1px solid rgba(255, 255, 255, 0.1); 
}

tooltip decoration {
     background-color: transparent; 
}
tooltip * {
     padding: 4px;
     background-color: transparent;
     color: white; 
}

You can change the background color of your tooltips via the background-color property.

And in the gtk-2.0 directory there's file named gtkrc which might contain a line like this :

# Tooltip colors
gtk-color-scheme = "tooltip_fg_color:#ffffff\ntooltip_bg_color:#000000"

If you want to change the tooltip background color for a gtk2 program ( they are very rare by now) you can adjust it.

You can change the theme via command line without the need to log-out and log-back . For example for a theme called Sweet :

gsettings set org.gnome.desktop.interface gtk-theme Sweet
gsettings set org.gnome.desktop.wm.preferences theme Sweet 

Happy hacking :)

EDIT : These are just for Gtk apps . But you haven't mentioned that you want to change the tooltips of Gtk or Qt apps . So if you want to customize Qt5 apps you can use a nice theme engine called Kvantum which is very customizable and is SVG based , so you can edit the background color of the tooltips via editing the theme files with something like Inkscape