summaryrefslogtreecommitdiff
path: root/engine/UI/Style.go
diff options
context:
space:
mode:
Diffstat (limited to 'engine/UI/Style.go')
-rw-r--r--engine/UI/Style.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/engine/UI/Style.go b/engine/UI/Style.go
index 091a6a3..1e05bcf 100644
--- a/engine/UI/Style.go
+++ b/engine/UI/Style.go
@@ -29,3 +29,12 @@ func (base *Style) FillMissing(defaultStyle *Style) {
base.Roundness = defaultLabelStyle.Roundness
}
}
+
+// Ensures that the provided style is not nil and fills in gaps with default style
+func InitStyle(provided *Style, defaultStyle *Style) *Style {
+ if provided == nil {
+ return defaultStyle
+ }
+ provided.FillMissing(defaultStyle)
+ return provided
+}