-
-
Notifications
You must be signed in to change notification settings - Fork 45
/
theme.go
74 lines (64 loc) · 1.93 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
package gui
import (
"image/color"
"sync"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/theme"
)
type go2tvTheme struct {
Theme string
}
var (
_ fyne.Theme = go2tvTheme{}
SystemVariant fyne.ThemeVariant = 999
signalSystemVariantChange = make(chan struct{})
once sync.Once
)
func (m go2tvTheme) Color(name fyne.ThemeColorName, variant fyne.ThemeVariant) color.Color {
switch m.Theme {
case "GrabVariant":
once.Do(func() {
SystemVariant = variant
go func() {
signalSystemVariantChange <- struct{}{}
}()
})
case "Dark":
variant = theme.VariantDark
switch name {
case theme.ColorNameDisabled:
return color.NRGBA{R: 0x55, G: 0x55, B: 0x55, A: 0xff}
case theme.ColorNameBackground:
return color.NRGBA{R: 0x30, G: 0x30, B: 0x30, A: 0xff}
case theme.ColorNameButton:
return color.NRGBA{R: 0x44, G: 0x44, B: 0x44, A: 0xff}
case theme.ColorNameDisabledButton:
return color.NRGBA{R: 0x26, G: 0x26, B: 0x26, A: 0xff}
case theme.ColorNameOverlayBackground:
return color.NRGBA{R: 0x30, G: 0x30, B: 0x30, A: 0xff}
case theme.ColorNameMenuBackground:
return color.NRGBA{R: 0x30, G: 0x30, B: 0x30, A: 0xff}
}
case "Light":
variant = theme.VariantLight
switch name {
case theme.ColorNameDisabled:
return color.NRGBA{R: 0xab, G: 0xab, B: 0xab, A: 0xff}
case theme.ColorNameInputBorder:
return color.NRGBA{R: 0xf3, G: 0xf3, B: 0xf3, A: 0xff}
case theme.ColorNameDisabledButton:
return color.NRGBA{R: 0xe5, G: 0xe5, B: 0xe5, A: 0xff}
}
}
theme.InnerPadding()
return theme.DefaultTheme().Color(name, variant)
}
func (m go2tvTheme) Icon(name fyne.ThemeIconName) fyne.Resource {
return theme.DefaultTheme().Icon(name)
}
func (m go2tvTheme) Font(style fyne.TextStyle) fyne.Resource {
return theme.DefaultTheme().Font(style)
}
func (m go2tvTheme) Size(name fyne.ThemeSizeName) float32 {
return theme.DefaultTheme().Size(name)
}