/
theme.go
118 lines (89 loc) · 2.08 KB
/
theme.go
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
package main
import (
"image/color"
"fyne.io/fyne"
"fyne.io/fyne/theme"
)
var (
purple = &color.RGBA{R: 128, G: 0, B: 128, A: 255}
orange = &color.RGBA{R: 198, G: 123, B: 0, A: 255}
grey = &color.Gray{Y: 123}
)
// customTheme is a simple demonstration of a bespoke theme loaded by a Fyne app.
type customTheme struct {
}
func (customTheme) BackgroundColor() color.Color {
return purple
}
func (customTheme) ButtonColor() color.Color {
return color.Black
}
func (customTheme) DisabledButtonColor() color.Color {
return color.White
}
func (customTheme) HyperlinkColor() color.Color {
return orange
}
func (customTheme) TextColor() color.Color {
return color.White
}
func (customTheme) DisabledTextColor() color.Color {
return color.Black
}
func (customTheme) IconColor() color.Color {
return color.White
}
func (customTheme) DisabledIconColor() color.Color {
return color.Black
}
func (customTheme) PlaceHolderColor() color.Color {
return grey
}
func (customTheme) PrimaryColor() color.Color {
return orange
}
func (customTheme) HoverColor() color.Color {
return orange
}
func (customTheme) FocusColor() color.Color {
return orange
}
func (customTheme) ScrollBarColor() color.Color {
return grey
}
func (customTheme) ShadowColor() color.Color {
return &color.RGBA{0xcc, 0xcc, 0xcc, 0xcc}
}
func (customTheme) TextSize() int {
return 12
}
func (customTheme) TextFont() fyne.Resource {
return theme.DefaultTextBoldFont()
}
func (customTheme) TextBoldFont() fyne.Resource {
return theme.DefaultTextBoldFont()
}
func (customTheme) TextItalicFont() fyne.Resource {
return theme.DefaultTextBoldItalicFont()
}
func (customTheme) TextBoldItalicFont() fyne.Resource {
return theme.DefaultTextBoldItalicFont()
}
func (customTheme) TextMonospaceFont() fyne.Resource {
return theme.DefaultTextMonospaceFont()
}
func (customTheme) Padding() int {
return 10
}
func (customTheme) IconInlineSize() int {
return 20
}
func (customTheme) ScrollBarSize() int {
return 10
}
func (customTheme) ScrollBarSmallSize() int {
return 5
}
func newCustomTheme() fyne.Theme {
return &customTheme{}
}