-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy paththeme.go
More file actions
55 lines (45 loc) · 1.32 KB
/
theme.go
File metadata and controls
55 lines (45 loc) · 1.32 KB
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
package main
import (
"image/color"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/theme"
)
type myTheme struct{}
func (m myTheme) Color(name fyne.ThemeColorName, variant fyne.ThemeVariant) color.Color {
switch name {
case theme.ColorNameBackground, theme.ColorNameMenuBackground, theme.ColorNameOverlayBackground:
return color.NRGBA{0x18, 0x0C, 0x27, 0xFF}
case theme.ColorNameForeground:
return color.White
case theme.ColorNamePrimary:
return color.NRGBA{0xFF, 0x85, 0x00, 0xFF}
case theme.ColorNameInputBackground:
return color.NRGBA{0x00, 0x00, 0x00, 0x00}
case theme.ColorNamePlaceHolder:
return color.NRGBA{0xFF, 0xFF, 0xFF, 0x40}
case theme.ColorNameFocus:
return theme.HoverColor()
default:
return theme.DefaultTheme().Color(name, variant)
}
}
func (m myTheme) Font(style fyne.TextStyle) fyne.Resource {
if style.Bold && style.Italic {
//Heavy with italics
return resourceWorkSansBlackItalicTtf
} else if style.Bold {
//heavy
return resourceWorkSansBlackTtf
} else if style.Monospace {
//Spaced out smaller font
return resourceWorkSansRegularTtf
}
//standard bold
return resourceWorkSansBoldTtf
}
func (m myTheme) Icon(name fyne.ThemeIconName) fyne.Resource {
return theme.DefaultTheme().Icon(name)
}
func (m myTheme) Size(name fyne.ThemeSizeName) float32 {
return theme.DefaultTheme().Size(name)
}