This repository has been archived by the owner on Nov 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy paththeme.go
72 lines (59 loc) · 2.01 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
package main
import (
"image/color"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/theme"
"github.com/achhabra2/kqb-json-viewer/font"
)
var bglLightColor color.RGBA = color.RGBA{240, 240, 240, 255}
var bglMedColor color.RGBA = color.RGBA{37, 40, 39, 255}
var bglDarkColor color.RGBA = color.RGBA{8, 8, 8, 255}
var bglBlueLight color.RGBA = color.RGBA{51, 153, 255, 255}
var bglBlueMed color.RGBA = color.RGBA{0, 71, 255, 255}
var bglBlueDark color.RGBA = color.RGBA{45, 60, 179, 255}
var bglGoldLight color.RGBA = color.RGBA{255, 204, 102, 255}
var bglGoldMed color.RGBA = color.RGBA{253, 184, 51, 255}
var bglGoldDark color.RGBA = color.RGBA{179, 123, 45, 255}
var highlightColor color.RGBA = color.RGBA{50, 50, 50, 100}
var primaryColor color.RGBA = color.RGBA{160, 85, 251, 255}
var buttonColor color.RGBA = color.RGBA{90, 112, 148, 255}
type myTheme struct{}
func (m myTheme) Color(name fyne.ThemeColorName, variant fyne.ThemeVariant) color.Color {
switch name {
case theme.ColorNameBackground:
return bglMedColor
case theme.ColorNameButton:
return buttonColor
case theme.ColorNamePrimary:
return primaryColor
case theme.ColorNameHover:
return highlightColor
case theme.ColorNameForeground:
return bglLightColor
case theme.ColorNameInputBackground:
return buttonColor
case theme.ColorNameFocus:
return bglGoldDark
default:
return theme.DefaultTheme().Color(name, theme.VariantDark)
}
}
func (m myTheme) Icon(name fyne.ThemeIconName) fyne.Resource {
// if name == theme.IconNameHome {
// fyne.NewStaticResource("myHome", homeBytes)
// }
return theme.DefaultTheme().Icon(name)
}
func (m myTheme) Font(style fyne.TextStyle) fyne.Resource {
defaultFont := fyne.NewStaticResource("Roboto-Regular", font.Roboto_Regular)
boldFont := fyne.NewStaticResource("Roboto-Bold", font.Roboto_Bold)
if style.Bold {
return boldFont
}
// return theme.DefaultTheme().Font(style)
return defaultFont
}
func (m myTheme) Size(name fyne.ThemeSizeName) float32 {
return theme.DefaultTheme().Size(name)
}
var _ fyne.Theme = (*myTheme)(nil)