-
Notifications
You must be signed in to change notification settings - Fork 4
/
Style.qml
108 lines (100 loc) · 2.73 KB
/
Style.qml
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
105
106
107
pragma Singleton
import QtQuick 2.15
import QtQuick.Controls.Material 2.12
Item {
id: root
property var theme: Material.theme
property var primary: Material.primary
property var accent: Material.accent
property var background: Material.background
property var foreground: Material.foreground
readonly property var primaryColor: Material.color(primary)
readonly property var accentColor: Material.color(accent)
readonly property var backgroundColor: Material.color(background)
readonly property var foregroundColor: Material.color(foreground)
function toggleTheme(){
root.theme = (root.theme === Material.Light ? Material.Dark : Material.Light)
}
function setDarkMode(enable){
// avoid binding loop
var mode = (enable ? Material.Dark : Material.Light)
if(root.theme !== mode) root.theme = mode
}
function isDarkMode(){
return root.theme === Material.Dark
}
property var colors: [
Material.Red ,
Material.Pink ,
Material.Purple ,
Material.DeepPurple ,
Material.Indigo ,
Material.Blue ,
Material.LightBlue ,
Material.Cyan ,
Material.Teal ,
Material.Green ,
Material.LightGreen ,
Material.Lime ,
Material.Yellow ,
Material.Amber ,
Material.Orange ,
Material.DeepOrange ,
Material.Brown ,
Material.Grey ,
Material.BlueGrey
]
property var shades: [
Material.Shade50,
Material.Shade100,
Material.Shade200,
Material.Shade300,
Material.Shade400,
Material.Shade500,
Material.Shade600,
Material.Shade700,
Material.Shade800,
Material.Shade900,
Material.ShadeA100,
Material.ShadeA200,
Material.ShadeA400,
Material.ShadeA700
]
property var colorNames: [
"Red" ,
"Pink" ,
"Purple" ,
"Deep Purple" ,
"Indigo" ,
"Blue" ,
"Light Blue" ,
"Cyan" ,
"Teal" ,
"Green" ,
"Light Green" ,
"Lime" ,
"Yellow" ,
"Amber" ,
"Orange" ,
"Deep Orange" ,
"Brown" ,
"Grey" ,
"Blue Grey"
]
property var shadeNames: [
"Shade50",
"Shade100",
"Shade200",
"Shade300",
"Shade400",
"Shade500",
"Shade600",
"Shade700",
"Shade800",
"Shade900",
"ShadeA100",
"ShadeA200",
"ShadeA400",
"ShadeA700"
]
}