Styles¶
Class ยท server and client scripts
Styles stores StyleBox overrides keyed by UI part (StylePart) and interaction state (StyleState) on a styled UI entity or World.Theme entity. Descendants inherit styles from the nearest ancestor with a matching entry.
Example
Set¶
Set assigns box as the StyleBox drawn for part while in interaction state.
| Parameter | Type | Description |
|---|---|---|
self |
Styles |
The Styles component view. |
part |
StylePart |
Control part name from StylePart. |
state |
StyleState |
Interaction state name from StyleState. |
box |
StyleBox |
Immutable StyleBox to apply. |
Example
Get¶
Get returns the StyleBox currently assigned to part and state on this entity, or nil when none is set.
| Parameter | Type | Description |
|---|---|---|
self |
Styles |
The Styles component view. |
part |
StylePart |
Control part name from StylePart. |
state |
StyleState |
Interaction state name from StyleState. |
Returns The assigned StyleBox, or nil.
Example
Clear¶
Clear removes the StyleBox override for part and state on this entity so controls fall back to parent or default styles.
| Parameter | Type | Description |
|---|---|---|
self |
Styles |
The Styles component view. |
part |
StylePart |
Control part name from StylePart. |
state |
StyleState |
Interaction state name from StyleState. |