-
Notifications
You must be signed in to change notification settings - Fork 0
/
theme.go
50 lines (42 loc) · 1.28 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
package main
import (
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/theme"
"image/color"
)
type myTheme struct{}
func (m *myTheme) Color(n fyne.ThemeColorName, v fyne.ThemeVariant) color.Color {
switch n {
case theme.ColorNameBackground:
if v == theme.VariantLight {
return &color.NRGBA{R: 0xF0, G: 0xE9, B: 0x9B, A: 0xFF}
}
return &color.NRGBA{R: 0x37, G: 0x2B, B: 0x09, A: 0xFF}
case theme.ColorNameForeground:
if v == theme.VariantLight {
return &color.NRGBA{R: 0x46, G: 0x3A, B: 0x11, A: 0xFF}
}
return &color.NRGBA{R: 0xF0, G: 0xE9, B: 0x9B, A: 0xFF}
case theme.ColorNamePrimary:
return &color.NRGBA{R: 0xff, G: 0xff, B: 0xff, A: 0xAA}
case theme.ColorNameFocus:
return &color.NRGBA{R: 0xff, G: 0xff, B: 0xff, A: 0x66}
case theme.ColorNameInputBackground:
// removes background from entry
return color.Transparent
//return &color.RGBA{R: 198, G: 210, B: 16, A: 75}
}
return theme.DefaultTheme().Color(n, v)
}
func (m *myTheme) Font(s fyne.TextStyle) fyne.Resource {
return theme.DefaultTheme().Font(s)
}
func (m *myTheme) Icon(n fyne.ThemeIconName) fyne.Resource {
return theme.DefaultTheme().Icon(n)
}
func (m *myTheme) Size(n fyne.ThemeSizeName) float32 {
if n == theme.SizeNameText {
return theme.DefaultTheme().Size(n) + 2
}
return theme.DefaultTheme().Size(n)
}