Factorio.com|Forums|Wiki|Mod Portal|API Docs

# Factorio Runtime Docs Version 2.0.77

# LuaStyle - Runtime Docs

## Class LuaStyle

Style of a GUI element. All of the attributes listed here may be `nil` if not available for a particular GUI element.

## Members

gui | :: R LuaGui | Gui of the LuaGuiElement of this style.
Gui of the LuaGuiElement of this style.
name | :: R string | Name of this style.
Name of this style.
minimal_width | :: RW int32 | Minimal width ensures, that the widget will never be smaller than than that size. [...]
Minimal width ensures, that the widget will never be smaller than than that size. [...]
maximal_width | :: RW int32 | Maximal width ensures, that the widget will never be bigger than than that size. [...]
Maximal width ensures, that the widget will never be bigger than than that size. [...]
minimal_height | :: RW int32 | Minimal height ensures, that the widget will never be smaller than than that size. [...]
Minimal height ensures, that the widget will never be smaller than than that size. [...]
maximal_height | :: RW int32 | Maximal height ensures, that the widget will never be bigger than than that size. [...]
Maximal height ensures, that the widget will never be bigger than than that size. [...]
natural_width | :: RW int32 | Natural width specifies the width of the element tries to have, but it can still be squashed/stretched to have a smaller or bigger size.
Natural width specifies the width of the element tries to have, but it can still be squashed/stretched to have a smaller or bigger size.
natural_height | :: RW int32 | Natural height specifies the height of the element tries to have, but it can still be squashed/stretched to have a smaller or bigger size.
Natural height specifies the height of the element tries to have, but it can still be squashed/stretched to have a smaller or bigger size.
top_padding | :: RW int16 |
right_padding | :: RW int16 |
bottom_padding | :: RW int16 |
left_padding | :: RW int16 |
top_margin | :: RW int16 |
right_margin | :: RW int16 |
bottom_margin | :: RW int16 |
left_margin | :: RW int16 |
horizontal_align | :: RW `"left"` or `"center"` or `"right"`? | Horizontal align of the inner content of the widget, if any.
Horizontal align of the inner content of the widget, if any.
vertical_align | :: RW `"top"` or `"center"` or `"bottom"`? | Vertical align of the inner content of the widget, if any.
Vertical align of the inner content of the widget, if any.
font_color | :: RW Color |
font | :: RW string |
top_cell_padding | :: RW int16 | Space between the table cell contents top and border.
Space between the table cell contents top and border.
right_cell_padding | :: RW int16 | Space between the table cell contents right and border.
Space between the table cell contents right and border.
bottom_cell_padding | :: RW int16 | Space between the table cell contents bottom and border.
Space between the table cell contents bottom and border.
left_cell_padding | :: RW int16 | Space between the table cell contents left and border.
Space between the table cell contents left and border.
horizontally_stretchable | :: RW boolean? | Whether the GUI element stretches its size horizontally to other elements. [...]
Whether the GUI element stretches its size horizontally to other elements. [...]
vertically_stretchable | :: RW boolean? | Whether the GUI element stretches its size vertically to other elements. [...]
Whether the GUI element stretches its size vertically to other elements. [...]
horizontally_squashable | :: RW boolean? | Whether the GUI element can be squashed (by maximal width of some parent element) horizontally. [...]
Whether the GUI element can be squashed (by maximal width of some parent element) horizontally. [...]
vertically_squashable | :: RW boolean? | Whether the GUI element can be squashed (by maximal height of some parent element) vertically. [...]
Whether the GUI element can be squashed (by maximal height of some parent element) vertically. [...]
rich_text_setting | :: RW defines.rich_text_setting | How this GUI element handles rich text.
How this GUI element handles rich text.
hovered_font_color | :: RW Color |
clicked_font_color | :: RW Color |
disabled_font_color | :: RW Color |
pie_progress_color | :: RW Color |
clicked_vertical_offset | :: RW uint32 |
selected_font_color | :: RW Color |
selected_hovered_font_color | :: RW Color |
selected_clicked_font_color | :: RW Color |
strikethrough_color | :: RW Color |
draw_grayscale_picture | :: RW boolean |
horizontal_spacing | :: RW int32 | Horizontal space between individual cells.
Horizontal space between individual cells.
vertical_spacing | :: RW int32 | Vertical space between individual cells.
Vertical space between individual cells.
use_header_filler | :: RW boolean |
bar_width | :: RW uint32 | The thickness of the bar, not the horizontal width.
The thickness of the bar, not the horizontal width.
color | :: RW Color |
column_alignments | :: R LuaCustomTable[uint32 → Alignment] | Array containing the alignment for every column of this table element. [...]
Array containing the alignment for every column of this table element. [...]
single_line | :: RW boolean |
extra_top_padding_when_activated | :: RW int32 |
extra_bottom_padding_when_activated | :: RW int32 |
extra_left_padding_when_activated | :: RW int32 |
extra_right_padding_when_activated | :: RW int32 |
extra_top_margin_when_activated | :: RW int32 |
extra_bottom_margin_when_activated | :: RW int32 |
extra_left_margin_when_activated | :: RW int32 |
extra_right_margin_when_activated | :: RW int32 |
extra_padding_when_activated | :: W int32 or array[int32] | Sets `extra_top/right/bottom/left_padding_when_activated` to this value. [...]
Sets `extra_top/right/bottom/left_padding_when_activated` to this value. [...]
extra_margin_when_activated | :: W int32 or array[int32] | Sets `extra_top/right/bottom/left_margin_when_activated` to this value. [...]
Sets `extra_top/right/bottom/left_margin_when_activated` to this value. [...]
stretch_image_to_widget_size | :: RW boolean |
badge_font | :: RW string |
badge_horizontal_spacing | :: RW int32 |
default_badge_font_color | :: RW Color |
selected_badge_font_color | :: RW Color |
disabled_badge_font_color | :: RW Color |
width | :: W int32 | Sets both minimal and maximal width to the given value.
Sets both minimal and maximal width to the given value.
height | :: W int32 | Sets both minimal and maximal height to the given value.
Sets both minimal and maximal height to the given value.
size | :: W int32 or array[int32] | Sets both width and height to the given value. [...]
Sets both width and height to the given value. [...]
padding | :: W int16 or array[int16] | Sets top/right/bottom/left paddings to this value. [...]
Sets top/right/bottom/left paddings to this value. [...]
margin | :: W int16 or array[int16] | Sets top/right/bottom/left margins to this value. [...]
Sets top/right/bottom/left margins to this value. [...]
cell_padding | :: W int16 | Space between the table cell contents and border. [...]
Space between the table cell contents and border. [...]
valid | :: R boolean | Is this object valid? [...]
Is this object valid? [...]
object_name | :: R string | The class name of this object. [...]
The class name of this object. [...]

## Attributes

### gui :: Read LuaGui

Gui of the LuaGuiElement of this style.

### name :: Read string

Name of this style.

### minimal_width :: Read|Write int32

Minimal width ensures, that the widget will never be smaller than than that size. It can't be squashed to be smaller.

### maximal_width :: Read|Write int32

Maximal width ensures, that the widget will never be bigger than than that size. It can't be stretched to be bigger.

### minimal_height :: Read|Write int32

Minimal height ensures, that the widget will never be smaller than than that size. It can't be squashed to be smaller.

### maximal_height :: Read|Write int32

Maximal height ensures, that the widget will never be bigger than than that size. It can't be stretched to be bigger.

### natural_width :: Read|Write int32

Natural width specifies the width of the element tries to have, but it can still be squashed/stretched to have a smaller or bigger size.

### natural_height :: Read|Write int32

Natural height specifies the height of the element tries to have, but it can still be squashed/stretched to have a smaller or bigger size.

### top_padding :: Read|Write int16

### right_padding :: Read|Write int16

### bottom_padding :: Read|Write int16

### left_padding :: Read|Write int16

### top_margin :: Read|Write int16

### right_margin :: Read|Write int16

### bottom_margin :: Read|Write int16

### left_margin :: Read|Write int16

### horizontal_align :: Read|Write `"left"` or `"center"` or `"right"`?

Horizontal align of the inner content of the widget, if any.

### vertical_align :: Read|Write `"top"` or `"center"` or `"bottom"`?

Vertical align of the inner content of the widget, if any.

### font_color :: Read|Write Color

### font :: Read|Write string

### top_cell_padding :: Read|Write int16

Space between the table cell contents top and border.

Can only be used if this is LuaTableStyle

### right_cell_padding :: Read|Write int16

Space between the table cell contents right and border.

Can only be used if this is LuaTableStyle

### bottom_cell_padding :: Read|Write int16

Space between the table cell contents bottom and border.

Can only be used if this is LuaTableStyle

### left_cell_padding :: Read|Write int16

Space between the table cell contents left and border.

Can only be used if this is LuaTableStyle

### horizontally_stretchable :: Read|Write boolean?

Whether the GUI element stretches its size horizontally to other elements. `nil` if this element does not support stretching.

### vertically_stretchable :: Read|Write boolean?

Whether the GUI element stretches its size vertically to other elements. `nil` if this element does not support stretching.

### horizontally_squashable :: Read|Write boolean?

Whether the GUI element can be squashed (by maximal width of some parent element) horizontally. `nil` if this element does not support squashing.

This is mainly meant to be used for scroll-pane. The default value is false.

### vertically_squashable :: Read|Write boolean?

Whether the GUI element can be squashed (by maximal height of some parent element) vertically. `nil` if this element does not support squashing.

This is mainly meant to be used for scroll-pane. The default (parent) value for scroll pane is true, false otherwise.

### rich_text_setting :: Read|Write defines.rich_text_setting

How this GUI element handles rich text.

Can only be used if this is LuaLabelStyle or LuaTextBoxStyle

### hovered_font_color :: Read|Write Color

Can only be used if this is LuaButtonStyle or LuaLabelStyle

### clicked_font_color :: Read|Write Color

Can only be used if this is LuaButtonStyle or LuaLabelStyle

### disabled_font_color :: Read|Write Color

Can only be used if this is LuaButtonStyle or LuaTabStyle or LuaLabelStyle or LuaTextBoxStyle

### pie_progress_color :: Read|Write Color

Can only be used if this is LuaButtonStyle

### clicked_vertical_offset :: Read|Write uint32

Can only be used if this is LuaButtonStyle

### selected_font_color :: Read|Write Color

Can only be used if this is LuaButtonStyle

### selected_hovered_font_color :: Read|Write Color

Can only be used if this is LuaButtonStyle

### selected_clicked_font_color :: Read|Write Color

Can only be used if this is LuaButtonStyle

### strikethrough_color :: Read|Write Color

Can only be used if this is LuaButtonStyle

### draw_grayscale_picture :: Read|Write boolean

Can only be used if this is LuaButtonStyle

### horizontal_spacing :: Read|Write int32

Horizontal space between individual cells.

Can only be used if this is LuaTableStyle or LuaFlowStyle or LuaHorizontalFlowStyle

### vertical_spacing :: Read|Write int32

Vertical space between individual cells.

Can only be used if this is LuaTableStyle or LuaFlowStyle or LuaVerticalFlowStyle or LuaTabbedPaneStyle

### use_header_filler :: Read|Write boolean

Can only be used if this is LuaFrameStyle

### bar_width :: Read|Write uint32

The thickness of the bar, not the horizontal width.

Can only be used if this is LuaProgressBarStyle

### color :: Read|Write Color

Can only be used if this is LuaProgressBarStyle

### column_alignments :: Read LuaCustomTable[uint32 → Alignment]

Array containing the alignment for every column of this table element. Even though this property is marked as read-only, the alignment can be changed by indexing the LuaCustomTable, like so:

#### Example

    table_element.style.column_alignments[1] = "center"

### single_line :: Read|Write boolean

Can only be used if this is LabelStyle

### extra_top_padding_when_activated :: Read|Write int32

Can only be used if this is ScrollPaneStyle

### extra_bottom_padding_when_activated :: Read|Write int32

Can only be used if this is ScrollPaneStyle

### extra_left_padding_when_activated :: Read|Write int32

Can only be used if this is ScrollPaneStyle

### extra_right_padding_when_activated :: Read|Write int32

Can only be used if this is ScrollPaneStyle

### extra_top_margin_when_activated :: Read|Write int32

Can only be used if this is ScrollPaneStyle

### extra_bottom_margin_when_activated :: Read|Write int32

Can only be used if this is ScrollPaneStyle

### extra_left_margin_when_activated :: Read|Write int32

Can only be used if this is ScrollPaneStyle

### extra_right_margin_when_activated :: Read|Write int32

Can only be used if this is ScrollPaneStyle

### extra_padding_when_activated :: Write int32 or array[int32]

Sets `extra_top/right/bottom/left_padding_when_activated` to this value.

An array with two values sets top/bottom padding to the first value and left/right padding to the second value. An array with four values sets top, right, bottom, left padding respectively.

### extra_margin_when_activated :: Write int32 or array[int32]

Sets `extra_top/right/bottom/left_margin_when_activated` to this value.

An array with two values sets top/bottom margin to the first value and left/right margin to the second value. An array with four values sets top, right, bottom, left margin respectively.

### stretch_image_to_widget_size :: Read|Write boolean

Can only be used if this is ImageStyle

### badge_font :: Read|Write string

Can only be used if this is TabStyle

### badge_horizontal_spacing :: Read|Write int32

Can only be used if this is TabStyle

### default_badge_font_color :: Read|Write Color

Can only be used if this is TabStyle

### selected_badge_font_color :: Read|Write Color

Can only be used if this is TabStyle

### disabled_badge_font_color :: Read|Write Color

Can only be used if this is TabStyle

### width :: Write int32

Sets both minimal and maximal width to the given value.

### height :: Write int32

Sets both minimal and maximal height to the given value.

### size :: Write int32 or array[int32]

Sets both width and height to the given value. Also accepts an array with two values, setting width to the first and height to the second one.

### padding :: Write int16 or array[int16]

Sets top/right/bottom/left paddings to this value.

An array with two values sets top/bottom padding to the first value and left/right padding to the second value. An array with four values sets top, right, bottom, left padding respectively.

### margin :: Write int16 or array[int16]

Sets top/right/bottom/left margins to this value.

An array with two values sets top/bottom margin to the first value and left/right margin to the second value. An array with four values sets top, right, bottom, left margin respectively.

### cell_padding :: Write int16

Space between the table cell contents and border. Sets top/right/bottom/left cell paddings to this value.

Can only be used if this is LuaTableStyle

### valid :: Read boolean

Is this object valid? This Lua object holds a reference to an object within the game engine. It is possible that the game-engine object is removed whilst a mod still holds the corresponding Lua object. If that happens, the object becomes invalid, i.e. this attribute will be `false`. Mods are advised to check for object validity if any change to the game state might have occurred between the creation of the Lua object and its access.

### object_name :: Read string

The class name of this object. Available even when `valid` is false. For LuaStruct objects it may also be suffixed with a dotted path to a member of the struct.

Class used in

- LuaGuiElement::style