Godot - Customizing Label Background
This is a code example for customizing the background of a Label node in GDScript.
You can customize the background color, corner radius, margin, border, and slant of a Label node using `add_theme_stylebox_override()
`.
The slant applied using `set_skew()
` does not affect the text.
# Label styles
var styles = StyleBoxFlat.new()
add_theme_stylebox_override('normal', styles)
# Label background color
styles .set_bg_color(Color("#000", 1))
# Label text margin
styles.set_content_margin_all(100)
# Label border color
styles.set_border_color(Color("#FF2222", 1))
# Label border width
styles.set_border_width_all(20)
# Label corner radius
styles.set_corner_radius_all(10)
# Label slant
styles.set_skew(Vector2(0.2, 0))