You are not logged in.

#1 2017-06-23 20:36:01

nbd
Member
Registered: 2014-08-04
Posts: 389

[SOLVED] How to change the tooltip background in GTK3?

Hello,

I'm using XFCE4 with default Adwaita theme and across all the applications tooltips have black background. In order to change the tooltip's background color to something else I added to the ~/.config/gtk-3.0/gtk.css file the following content:

@define-color base_color #ffffff;
@define-color tooltip_bg_color #00ff00;
@define-color tooltip_fg_color #ff0000;
@define-color theme_tooltip_bg_color @tooltip_bg_color;
@define-color theme_tooltip_fg_color @tooltip_fg_color;

.tooltip {
  padding: 5px 5px 5px 5px;
  margin: 0px 0px 0px 0px;
    border-width: 1px;
    border-style: solid;
    border-radius: 0px;
    border-color: #ffffff;
    background-image: none;
    background-color: #ffffff;
    color: #454545;
    border: 0px;
}

.tooltip * {
    background-color: #ffffff;
    font-weight: bold;
    padding: 5px 5px 5px 5px;
    margin: 0px 0px 0px 0px;
    border-width: 1px;
    border-style: solid;
    border-color: @tooltip_bg_color;
    color: #454545;
    text-shadow: 5px 5px 3px #bbbbbb, 7px 7px 3px #ccccFF;
}

But this hasn't changed anyting. What is the correct way to change the tooltip's background in GTK 3.0?

Last edited by nbd (2017-06-24 05:25:34)


bing different

Offline

#2 2017-06-23 21:17:32

FlowIt
Member
Registered: 2014-10-25
Posts: 239

Re: [SOLVED] How to change the tooltip background in GTK3?

XFCE still uses gtk2 (at least the majority of XFCE applications). You can edit your .gtkrc-2.0 config file, tooltip_bg_color is the key that you are looking for.

Last edited by FlowIt (2017-06-23 21:17:54)

Offline

#3 2017-06-23 21:41:50

nbd
Member
Registered: 2014-08-04
Posts: 389

Re: [SOLVED] How to change the tooltip background in GTK3?

@FlowIt

I mentioned not only XFCE4 aplications, but all applications on my machine, including pure GTK3 ones: Firefox, Eclipse, LibreOffice, Gnome Calculator. They all have black tooltips.

Nonetheless, I added the following code to the ~/.gtkrc-2.0

gtk-color-scheme = "bg_color: #ffd7e7
                                 fg_color: #000
                                 base_color: #fff
                                 text_color: #da2820
                                 selected_bg_color: #4c4c4c
                                 selected_fg_color: #fff
                                 tooltip_bg_color: #e5e5e5
                                 tooltip_fg_color: #000000"

This hasn't changed anything.


bing different

Offline

#4 2017-06-23 23:22:57

nbd
Member
Registered: 2014-08-04
Posts: 389

Re: [SOLVED] How to change the tooltip background in GTK3?

Actually, editing ~/.gtkrc-2.0 changed tooltips in GTK2 applications. But not in GTK3 applications. Isn't GTK3  honoring user's ~/.config/gtk-3.0/gtk.css settings anymore? If so, is there a way for the user to customize themes in GTK3.0 without creating it's own one?


bing different

Offline

#5 2017-06-24 03:41:58

toz
Member
Registered: 2011-10-28
Posts: 494

Re: [SOLVED] How to change the tooltip background in GTK3?

As I understand it, prefixing "tooltip" with a "." refers to a style class by that name (if its defined). Leaving out the "." references the GTKTooltip widget itself. Also, prepending with a "#", references the actual widget name. So, if you used:

tooltip {
  ...
}

...you should be able to affect the tooltips.

Offline

#6 2017-06-24 05:25:01

nbd
Member
Registered: 2014-08-04
Posts: 389

Re: [SOLVED] How to change the tooltip background in GTK3?

toz, many thanks!


bing different

Offline

Board footer

Powered by FluxBB