Factorio.com|Forums|Wiki|Mod Portal|API Docs Prototype|Runtime|Auxiliary

# Factorio Runtime Docs Version 2.0.7

## 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 int | 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 int | 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 int | 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 int | 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 int | 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 int | 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 int |
right_padding | :: RW int |
bottom_padding | :: RW int |
left_padding | :: RW int |
top_margin | :: RW int |
right_margin | :: RW int |
bottom_margin | :: RW int |
left_margin | :: RW int |
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 int | Space between the table cell contents top and border.
Space between the table cell contents top and border.
right_cell_padding | :: RW int | Space between the table cell contents right and border.
Space between the table cell contents right and border.
bottom_cell_padding | :: RW int | Space between the table cell contents bottom and border.
Space between the table cell contents bottom and border.
left_cell_padding | :: RW int | 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 int |
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 int | Horizontal space between individual cells.
Horizontal space between individual cells.
vertical_spacing | :: RW int | Vertical space between individual cells.
Vertical space between individual cells.
use_header_filler | :: RW boolean |
bar_width | :: RW uint |
color | :: RW Color |
column_alignments | :: R LuaCustomTable[uint → 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 int |
extra_bottom_padding_when_activated | :: RW int |
extra_left_padding_when_activated | :: RW int |
extra_right_padding_when_activated | :: RW int |
extra_top_margin_when_activated | :: RW int |
extra_bottom_margin_when_activated | :: RW int |
extra_left_margin_when_activated | :: RW int |
extra_right_margin_when_activated | :: RW int |
extra_padding_when_activated | :: W int or array[int] | 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 int or array[int] | 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 int |
default_badge_font_color | :: RW Color |
selected_badge_font_color | :: RW Color |
disabled_badge_font_color | :: RW Color |
width | :: W int | Sets both minimal and maximal width to the given value.
Sets both minimal and maximal width to the given value.
height | :: W int | Sets both minimal and maximal height to the given value.
Sets both minimal and maximal height to the given value.
size | :: W int or array[int] | Sets both width and height to the given value. [...]
Sets both width and height to the given value. [...]
padding | :: W int or array[int] | Sets top/right/bottom/left paddings to this value. [...]
Sets top/right/bottom/left paddings to this value. [...]
margin | :: W int or array[int] | Sets top/right/bottom/left margins to this value. [...]
Sets top/right/bottom/left margins to this value. [...]
cell_padding | :: W int | 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 int

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 int

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 int

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 int

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 int

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 int

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 int

### right_padding :: Read|Write int

### bottom_padding :: Read|Write int

### left_padding :: Read|Write int

### top_margin :: Read|Write int

### right_margin :: Read|Write int

### bottom_margin :: Read|Write int

### left_margin :: Read|Write int

### 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 int

Space between the table cell contents top and border.

Can only be used if this is LuaTableStyle

### right_cell_padding :: Read|Write int

Space between the table cell contents right and border.

Can only be used if this is LuaTableStyle

### bottom_cell_padding :: Read|Write int

Space between the table cell contents bottom and border.

Can only be used if this is LuaTableStyle

### left_cell_padding :: Read|Write int

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 or LuaTextFieldStyle

### hovered_font_color :: Read|Write Color

Can only be used if this is LuaButtonStyle

### clicked_font_color :: Read|Write Color

Can only be used if this is LuaButtonStyle

### disabled_font_color :: Read|Write Color

Can only be used if this is LuaButtonStyle or LuaTabStyle

### pie_progress_color :: Read|Write Color

Can only be used if this is LuaButtonStyle

### clicked_vertical_offset :: Read|Write int

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 int

Horizontal space between individual cells.

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

### vertical_spacing :: Read|Write int

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 uint

Can only be used if this is LuaProgressBarStyle

### color :: Read|Write Color

Can only be used if this is LuaProgressBarStyle

### column_alignments :: Read LuaCustomTable[uint → 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 int

Can only be used if this is ScrollPaneStyle

### extra_bottom_padding_when_activated :: Read|Write int

Can only be used if this is ScrollPaneStyle

### extra_left_padding_when_activated :: Read|Write int

Can only be used if this is ScrollPaneStyle

### extra_right_padding_when_activated :: Read|Write int

Can only be used if this is ScrollPaneStyle

### extra_top_margin_when_activated :: Read|Write int

Can only be used if this is ScrollPaneStyle

### extra_bottom_margin_when_activated :: Read|Write int

Can only be used if this is ScrollPaneStyle

### extra_left_margin_when_activated :: Read|Write int

Can only be used if this is ScrollPaneStyle

### extra_right_margin_when_activated :: Read|Write int

Can only be used if this is ScrollPaneStyle

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

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 int or array[int]

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 int

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 int

Sets both minimal and maximal width to the given value.

### height :: Write int

Sets both minimal and maximal height to the given value.

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

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 int or array[int]

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 int or array[int]

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 int

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.