Search code examples
cssbuttonuser-interfacegtkstylesheet

Change font color of insensitive GtkToggleButton through CSS


I am trying to style a button in a Gtk program using CSS.
Everything works quite well, except for one thing: I'd like to make the font black when the button is insensitive, overriding the light grey default one, but I can't make it work.
Here is my CSS file:

GtkToggleButton#togglebuttonuser:insensitive {
    background: #729fcf;
    background-color: #729fcf;
    color: black;
}

But when the button goes into insensitive state here is how it looks:

enter image description here

So, background color is applied correctly, but font remains grey... where am I going wrong?


Solution

  • Try the selector #togglebuttonuser:insensitive * (recent GTK versions) or #togglebuttonuser *:insensitive (earlier GTK versions).