Control.addStyleboxOverride

Overrides the StyleBox with given name in the theme resource the control uses. If stylebox is empty or invalid, the override is cleared and the StyleBox from assigned Theme is used. Example of modifying a property in a StyleBox by duplicating it:

More...
struct Control
@nogc nothrow
void
addStyleboxOverride
(
in String name
,)

Detailed Description

# The snippet below assumes the child node MyButton has a StyleBoxFlat assigned. # Resources are shared across instances, so we need to duplicate it # to avoid modifying the appearance of all other buttons. var new_stylebox_normal = $MyButton.get_stylebox("normal").duplicate() new_stylebox_normal.border_width_top = 3 new_stylebox_normal.border_color = Color(0, 1, 0.5) $MyButton.add_stylebox_override("normal", new_stylebox_normal)

# Remove the stylebox override: $MyButton.add_stylebox_override("normal", null)

Meta