Package: gtk

Function gtk:widget-override-color

Lambda List

gtk:widget-override-color (widget state color)

Arguments

widget -- a gtk:widget object
state -- a gtk:state-flags value for which to set the color
color -- a gdk:rgba color to assign, or nil to undo the effect of previous calls

Details

Sets the color to use for a widget. All other style values are left untouched.

Notes

  • 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 and regions in your widget/container implementation through the gtk:style-context-add-class and gtk:style-context-add-region functions. This way, your widget library can install a gtk:css-provider object with the gtk:+priority-fallback+ priority in order to provide a default styling for those widgets that need so, and this theming may fully overridden by the theme of the user.
  • 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 gtk:css-provider object with the gtk:+priority-application+ priority.

Warning

The gtk:widget-override-color function has been deprecated since version 3.16 and should not be used in newly written code. Use a custom style provider and style classes instead.
 

See also

#2023-3-26