3

How to set color for one button in GTK+

GtkButton button8 { 
border-radius: 20;
border-width: 1 1 1 1;
font: Sans 16;
color: black;
background-image: -gtk-gradient (linear,
             left top,
             left bottom,
             color-stop(0.0,rgba(34,97,170,1)),
             color-stop(0.50,rgba(56,145,218,1)),
             color-stop(0.51,rgba(34,131,216,1)),
             color-stop(1.00,rgba(134,191,234,1)));
}

This css changes the color of al buttons in glade file.How should i change the css so that it affects only one button?

ganeshredcobra
  • 1,881
  • 3
  • 28
  • 44

1 Answers1

6

gtk_widget_set_name (widget, "fooname"); or do the same in glade:


mark of are to set the image name


then use something like

GtkButton#fooname {
     border-radius: 20;
     ...
}

See https://developer.gnome.org/gtk3/stable/GtkCssProvider.html

drahnr
  • 6,782
  • 5
  • 48
  • 75