-
Notifications
You must be signed in to change notification settings - Fork 33
/
theme.go
46 lines (39 loc) · 1.03 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
package main
import (
"image/color"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/theme"
)
type MyTheme struct{}
func (MyTheme) Color(n fyne.ThemeColorName, v fyne.ThemeVariant) color.Color {
switch n {
case theme.ColorNamePrimary:
return color.NRGBA{R: 0xe6, G: 0x77, B: 0x2e, A: 0xff}
case theme.ColorNameHyperlink:
return color.NRGBA{R: 0xe6, G: 0x77, B: 0x2e, A: 0xff}
case theme.ColorNameFocus:
return color.NRGBA{R: 0xf5, G: 0x65, B: 0x08, A: 0x2a}
case theme.ColorNameSelection:
return color.NRGBA{R: 0xf5, G: 0x65, B: 0x08, A: 0x2a}
default:
return theme.DefaultTheme().Color(n, v)
}
}
func (MyTheme) Font(s fyne.TextStyle) fyne.Resource {
if s.Italic || s.Symbol {
return theme.DefaultTheme().Font(s)
}
if s.Monospace {
return resourceDroidSansMono
}
if s.Bold {
return resourceDroidSansBold
}
return resourceDroidSansFallback
}
func (MyTheme) Icon(n fyne.ThemeIconName) fyne.Resource {
return theme.DefaultTheme().Icon(n)
}
func (MyTheme) Size(s fyne.ThemeSizeName) float32 {
return theme.DefaultTheme().Size(s)
}