-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththeme.go
More file actions
68 lines (63 loc) · 2.42 KB
/
theme.go
File metadata and controls
68 lines (63 loc) · 2.42 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package gui
import (
"github.com/maxfish/GoNativeUI-Core/utils"
)
type Theme struct {
BaseStyle WidgetStyle
Label WidgetStyle
Button WidgetStyle
Checkbox WidgetStyle
TextField WidgetStyle
ImageView WidgetStyle
ListView WidgetStyle
ComboBox WidgetStyle
}
func NewDefaultTheme(baseFont IFont) *Theme {
t := &Theme{}
t.BaseStyle = WidgetStyle{
Font: baseFont,
FontSize: 15,
BackgroundColor: utils.NewColorHex(0x3C3F41FF),
BorderColor: utils.NewColorHex(0x59595AFF),
Padding: utils.Insets{},
ContentAlignment: utils.Alignment{},
TextColor: utils.NewColorHex(0xAFB1B3FF),
CursorColor: utils.NewColorHex(0xDDDDDDFF),
TextDisabledColor: utils.NewColorHex(0xAFB1B3FF).Scaled(0.6),
IconColor: utils.NewColorHex(0xAFB1B3FF),
IconDisabledColor: utils.NewColorHex(0xAFB1B3FF).Scaled(0.6),
SelectionColor: utils.NewColorHex(0x1A65D1FF),
ErrorColor: utils.NewColorHex(0x743A3AFF),
}
// Label
t.Label = t.BaseStyle
t.Label.BackgroundColor = utils.TransparentColor
// Button
t.Button = t.BaseStyle
t.Button.BackgroundColor = utils.NewColorHex(0x4B5052FF)
t.Button.Padding = utils.Insets{Top: 5, Right: 10, Bottom: 5, Left: 10}
// Checkbox
t.Checkbox = t.BaseStyle
t.Checkbox.Padding = utils.Insets{Top: 2, Right: 2, Bottom: 2, Left: 2}
t.Checkbox.ContentAlignment = utils.Alignment{Horizontal: utils.AlignmentHLeft, Vertical: utils.AlignmentVCenter}
// TextField
t.TextField = t.BaseStyle
t.TextField.Padding = utils.Insets{Top: 2, Right: 4, Bottom: 2, Left: 4}
t.TextField.ContentAlignment = utils.Alignment{Horizontal: utils.AlignmentHLeft, Vertical: utils.AlignmentVCenter}
t.TextField.BackgroundColor = utils.NewColorHex(0x44494AFF)
t.TextField.BorderColor = utils.NewColorHex(0x646464FF)
// ImageView
t.ImageView = t.BaseStyle
t.ImageView.BackgroundColor = utils.TransparentColor
// ListView
t.ListView = t.BaseStyle
t.ListView.BackgroundColor = utils.NewColorHex(0x4B5052FF)
t.ListView.Padding = utils.HomogeneousInsets(4)
t.ListView.ContentAlignment = utils.Alignment{Horizontal: utils.AlignmentHLeft, Vertical: utils.AlignmentVCenter}
// ComboBox
t.ComboBox = t.BaseStyle
t.ComboBox.BackgroundColor = utils.NewColorHex(0x4B5052FF)
t.ComboBox.Padding = utils.Insets{Top: 5, Right: 3, Bottom: 5, Left: 3}
t.ComboBox.ContentAlignment = utils.Alignment{Horizontal: utils.AlignmentHLeft, Vertical: utils.AlignmentVCenter}
return t
}