Method

GtkWidgetoverride_color

Declaration [src]

void
gtk_widget_override_color (
  GtkWidget* widget,
  GtkStateFlags state,
  const GdkRGBA* color
)

Description [src]

Sets the color to use for a widget.

All other style values are left untouched.

This function does not act recursively. Setting the color of a container does not affect its children. Note that some widgets that you may not think of as containers, for instance GtkButtons, are actually containers.

This API is mostly meant as a quick way for applications to change a widget appearance. If you are developing a widgets library and intend this change to be themeable, it is better done by setting meaningful CSS classes in your widget/container implementation through gtk_style_context_add_class().

This way, your widget library can install a GtkCssProvider with the GTK_STYLE_PROVIDER_PRIORITY_FALLBACK priority in order to provide a default styling for those widgets that need so, and this theming may fully overridden by the user’s theme.

Note that for complex widgets this may bring in undesired results (such as uniform background color everywhere), in these cases it is better to fully style such widgets through a GtkCssProvider with the GTK_STYLE_PROVIDER_PRIORITY_APPLICATION priority.

Available since:3.0
Deprecated since:3.16

Use a custom style provider and style classes instead.

Parameters

state GtkStateFlags
 

The state for which to set the color.

color GdkRGBA
 

The color to assign, or NULL to undo the effect of previous calls to gtk_widget_override_color()

 The argument can be NULL.
 The data is owned by the caller of the function.