Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions addons/theme_gen/programmatic_theme.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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
}