Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

StyleBoxFlat

Inherits: StyleBox < Resource < RefCounted < Object

A customizable StyleBox that doesn't use a texture.

Description

By configuring various properties of this style box, you can achieve many common looks without the need of a texture. This includes optionally rounded borders, antialiasing, shadows, and skew.

Setting corner radius to high values is allowed. As soon as corners overlap, the stylebox will switch to a relative system.

Example:

height = 30
corner_radius_top_left = 50
corner_radius_bottom_left = 100

The relative system now would take the 1:2 ratio of the two left corners to calculate the actual corner width. Both corners added will never be more than the height. Result:

corner_radius_top_left: 10
corner_radius_bottom_left: 20

Properties

bool

anti_aliasing

true

float

anti_aliasing_size

1.0

Color

bg_color

Color(0.6, 0.6, 0.6, 1)

bool

border_blend

false

Color

border_color

Color(0.8, 0.8, 0.8, 1)

int

border_width_bottom

0

int

border_width_left

0

int

border_width_right

0

int

border_width_top

0

int

corner_detail

8

int

corner_radius_bottom_left

0

int

corner_radius_bottom_right

0

int

corner_radius_top_left

0

int

corner_radius_top_right

0

bool

draw_center

true

float

expand_margin_bottom

0.0

float

expand_margin_left

0.0

float

expand_margin_right

0.0

float

expand_margin_top

0.0

Color

shadow_color

Color(0, 0, 0, 0.6)

Vector2

shadow_offset

Vector2(0, 0)

int

shadow_size

0

Vector2

skew

Vector2(0, 0)

Methods

int

get_border_width(margin: Side) const

int

get_border_width_min() const

int

get_corner_radius(corner: Corner) const

float

get_expand_margin(margin: Side) const

void

set_border_width(margin: Side, width: int)

void

set_border_width_all(width: int)

void

set_corner_radius(corner: Corner, radius: int)

void

set_corner_radius_all(radius: int)

void

set_expand_margin(margin: Side, size: float)

void

set_expand_margin_all(size: float)


Property Descriptions

bool anti_aliasing = true