summaryrefslogtreecommitdiff
path: root/engine/UI/Style.go
blob: 091a6a33403868c51a91aba4567a4646f3594d97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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 = defaultLabelStyle.BacgroundColor
	}
	if base.Padding == nil {
		base.Padding = defaultLabelStyle.Padding
	}
	if base.FontColor == nil {
		base.FontColor = defaultLabelStyle.FontColor
	}
	if base.Roundness == nil {
		base.Roundness = defaultLabelStyle.Roundness
	}
}