-
Notifications
You must be signed in to change notification settings - Fork 6
/
theme.go
65 lines (56 loc) · 1.52 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
// Code generated by fyne-theme-generator
package main
import (
"image/color"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/theme"
)
type myTheme struct{}
func (l *myTheme) Color(n fyne.ThemeColorName, v fyne.ThemeVariant) color.Color {
switch n {
case theme.ColorNameBackground:
return color.RGBA{R: 0xff, G: 0xff, B: 0xff, A: 0xff}
case theme.ColorNameForeground:
return color.RGBA{R: 0x21, G: 0x21, B: 0x21, A: 0xff}
case theme.ColorNameInputBackground:
return color.RGBA{R: 0xff, G: 0xff, B: 0xff, A: 0xff}
case theme.ColorNamePrimary:
return color.RGBA{R: 0x2e, G: 0x85, B: 0x55, A: 0xff}
default:
return theme.DefaultTheme().Color(n, v)
}
}
func (l *myTheme) Font(s fyne.TextStyle) fyne.Resource {
if s.Monospace {
return theme.LightTheme().Font(fyne.TextStyle{Monospace: true})
}
if s.Bold {
if s.Italic {
return theme.LightTheme().Font(fyne.TextStyle{Bold: true, Italic: true})
}
return theme.LightTheme().Font(fyne.TextStyle{Bold: true})
}
if s.Italic {
return theme.LightTheme().Font(fyne.TextStyle{Italic: true})
}
return theme.LightTheme().Font(fyne.TextStyle{})
}
func (l *myTheme) Icon(n fyne.ThemeIconName) fyne.Resource {
return theme.DefaultTheme().Icon(n)
}
func (l *myTheme) Size(n fyne.ThemeSizeName) float32 {
switch n {
case theme.SizeNameInlineIcon:
return 20.0
case theme.SizeNamePadding:
return 4.0
case theme.SizeNameScrollBar:
return 16.0
case theme.SizeNameScrollBarSmall:
return 3.0
case theme.SizeNameText:
return 14.0
default:
return theme.DefaultTheme().Size(n)
}
}