-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy paththeme.go
39 lines (32 loc) · 779 Bytes
/
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
// theme.go
package main
import (
"image/color"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/theme"
)
type customTheme struct{}
func (customTheme) Font(s fyne.TextStyle) fyne.Resource {
if s.Monospace {
return theme.DefaultTextMonospaceFont()
}
if s.Bold {
if s.Italic {
return theme.DefaultTextBoldItalicFont()
}
return theme.DefaultTextBoldFont()
}
if s.Italic {
return theme.DefaultTextItalicFont()
}
return theme.DefaultTextFont()
}
func (customTheme) Color(n fyne.ThemeColorName, v fyne.ThemeVariant) color.Color {
return theme.DefaultTheme().Color(n, v)
}
func (customTheme) Icon(n fyne.ThemeIconName) fyne.Resource {
return theme.DefaultTheme().Icon(n)
}
func (customTheme) Size(n fyne.ThemeSizeName) float32 {
return theme.DefaultTheme().Size(n)
}