package ui import ( rl "github.com/gen2brain/raylib-go/raylib" ) // Arguments that UI elements use to render type Style struct { BacgroundColor *rl.Color FontColor *rl.Color Padding *float32 // Used in the drawing rectangles. Works like border-radius Roundness *float32 } // Fills up not specifiend elements with default ones func (base *Style) FillMissing(defaultStyle *Style) { if base.BacgroundColor == nil { base.BacgroundColor = defaultStyle.BacgroundColor } if base.Padding == nil { base.Padding = defaultStyle.Padding } if base.FontColor == nil { base.FontColor = defaultStyle.FontColor } if base.Roundness == nil { base.Roundness = defaultStyle.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 }