-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy paththeme.go
104 lines (96 loc) · 3.19 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// Netrunner
// Copyright 2021-2023 DERO Foundation. All rights reserved.
// Use of this source code in any form is governed by RESEARCH license.
// license can be found in the LICENSE file.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package main
import (
"image/color"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/theme"
)
type nTheme struct{}
func (nTheme) Color(c fyne.ThemeColorName, v fyne.ThemeVariant) color.Color {
switch c {
case theme.ColorNameBackground:
return color.NRGBA{R: 9, G: 17, B: 25, A: 0xff}
case theme.ColorNameButton:
return color.NRGBA{R: 64, G: 64, B: 64, A: 0x72}
case theme.ColorNameDisabledButton:
return color.NRGBA{R: 30, G: 30, B: 30, A: 0x62}
case theme.ColorNameDisabled:
return color.NRGBA{R: 164, G: 164, B: 164, A: 0x42}
case theme.ColorNameError:
return color.NRGBA{R: 0xf4, G: 0x43, B: 0x36, A: 0xff}
case theme.ColorNameFocus:
return color.NRGBA{R: 164, G: 164, B: 164, A: 0x7f}
case theme.ColorNameForeground:
return color.NRGBA{R: 208, G: 208, B: 208, A: 0x85}
case theme.ColorNameHover:
//return color.NRGBA{R: 99, G: 99, B: 110, A: 0xff}
return color.NRGBA{R: 185, G: 71, B: 68, A: 0xff}
case theme.ColorNameInputBackground:
return color.Alpha16{A: 0x0}
case theme.ColorNamePlaceHolder:
return color.NRGBA{R: 0x88, G: 0x88, B: 0x88, A: 0xff}
case theme.ColorNamePressed:
return color.NRGBA{R: 208, G: 208, B: 208, A: 0x19}
case theme.ColorNamePrimary:
return color.NRGBA{R: 208, G: 208, B: 208, A: 0xff}
case theme.ColorNameScrollBar:
return color.NRGBA{R: 185, G: 71, B: 68, A: 0x99}
case theme.ColorNameShadow:
return color.Alpha16{0x19}
default:
return theme.DefaultTheme().Color(c, v)
}
}
func (nTheme) Font(s fyne.TextStyle) fyne.Resource {
if s.Monospace {
return resourceRegularTtf
}
if s.Bold {
if s.Italic {
return resourceBoldItalicTtf
}
return resourceBoldTtf
}
if s.Italic {
return resourceItalicTtf
}
return resourceRegularTtf
}
func (nTheme) Icon(n fyne.ThemeIconName) fyne.Resource {
return theme.DefaultTheme().Icon(n)
}
func (nTheme) Size(s fyne.ThemeSizeName) float32 {
switch s {
case theme.SizeNameCaptionText:
return 11
case theme.SizeNameInlineIcon:
return 20
case theme.SizeNamePadding:
return 4
case theme.SizeNameScrollBar:
return 16
case theme.SizeNameScrollBarSmall:
return 3
case theme.SizeNameSeparatorThickness:
return 1
case theme.SizeNameText:
return 15
case theme.SizeNameInputBorder:
return 2
default:
return theme.DefaultTheme().Size(s)
}
}