How do I set the color and font of a GtkLabel using a Resource File?

GTK+ FAQ
<<< Previous | Development with GTK+: widget specific questions | Next >>>

# How do I set the color and font of a GtkLabel using a Resource File?

The widget name path constructed for a Label consists of the widget names of its object hierarchy as well, e.g.

`window (name: humphrey)`
`hbox`
`label (name: mylabel)`

The widget path your pattern needs to match would be: `humphrey.GtkHBox.mylabel`

The resource file may look something like:

    style "title"
    {
          fg[NORMAL] = {1.0, 0.0, 0.0}
          font = "-adobe-helvetica-bold-r-normal--*-140-*-*-*-*-*-*"
    }
    widget "*mylabel" style "title"

In your program, you would also need to give a name to the Label widget, which can be done using:

      label = gtk_label_new("Some Label Text");
      gtk_widget_set_name(label, "mylabel");
      gtk_widget_show(label);

<<< Previous | Home | Next >>>
How do I set the background color of a GtkLabel widget? | Up | How do I configure Tooltips in a Resource File?