diff --git a/README.md b/README.md index 16f7bbc..a5e6684 100644 --- a/README.md +++ b/README.md @@ -304,11 +304,12 @@ Besides this method, there are also the following shortcut methods for repetitiv - `expand_margins(...)` - `content_margins(...)` - `texture_margins(...)` +- `margins(...)` ### Creating Custom Style Variations The Godot theming system also allows you to create multiple styles for the same node, by defining *variations*. Variations can inherit from the base style of a node or from another variation (https://docs.godotengine.org/en/stable/tutorials/ui/gui_theme_type_variations.html). -To create one in code, use the `define_style_variant(name, base_name, style)` method. +To create one in code, use the `define_variant_style(name, base_name, style)` method. ```gdscript var title_font_size = 20 diff --git a/addons/theme_gen/programmatic_theme.gd b/addons/theme_gen/programmatic_theme.gd index eeb5e7c..58df534 100644 --- a/addons/theme_gen/programmatic_theme.gd +++ b/addons/theme_gen/programmatic_theme.gd @@ -483,3 +483,15 @@ func texture_margins(left: int, top = null, right = null, bottom = null): "texture_margin_right": right, "texture_margin_bottom": bottom } + +func margins(left: int, top = null, right = null, bottom = null): + if top == null: top = left + if right == null: right = left + if bottom == null: bottom = top + + return { + "margin_left": left, + "margin_top": top, + "margin_right": right, + "margin_bottom": bottom + }