-
Notifications
You must be signed in to change notification settings - Fork 0
/
theme.go
57 lines (48 loc) · 1.24 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
package main
import (
"image/color"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/theme"
)
type myTheme struct{}
var _ fyne.Theme = (*myTheme)(nil)
var BackgroundColor = color.RGBA{18, 18, 18, 255}
var OverlayBackgroundColor = color.RGBA{25, 25, 25, 255}
func (m myTheme) Color(name fyne.ThemeColorName, variant fyne.ThemeVariant) color.Color {
switch name {
case theme.ColorNameBackground:
return BackgroundColor
case theme.ColorNameOverlayBackground:
return OverlayBackgroundColor
case theme.ColorNameHyperlink:
return m.Color(theme.ColorNameForeground, variant)
}
return theme.DefaultTheme().Color(name, variant)
}
func (m myTheme) Icon(name fyne.ThemeIconName) fyne.Resource {
return theme.DefaultTheme().Icon(name)
}
func (m myTheme) Font(style fyne.TextStyle) fyne.Resource {
if style.Bold {
if style.Italic {
return resourceRobotoBoldItalicTtf
}
return resourceRobotoBoldTtf
}
if style.Italic {
return resourceRobotoItalicTtf
}
if style.Monospace {
return resourceRobotoMonoLightTtf
}
return resourceRobotoRegularTtf
}
func (m myTheme) Size(name fyne.ThemeSizeName) float32 {
//if name == theme.SizeNameInputRadius {
// return 20
//}
if name == theme.SizeNamePadding {
return 5
}
return theme.DefaultTheme().Size(name)
}