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?

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

4 Comments

is fooname the Label name
In glade version 3.14.2 Widget name attribute is missing Which version are you using?
# glade --version glade 3.16.1
Where do you put the CSS?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.