-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathTheme.qml
57 lines (44 loc) · 2.03 KB
/
Theme.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
import QtQuick 2.0
pragma Singleton
Object {
id: theme
property color primaryColor: "#99CEEE"
property color primaryDarkColor: "#1976D2"
property color accentColor: "#99CEEE"
property color backgroundColor: Qt.rgba(0.3, 0.3, 0.3)
property ThemePalette light: ThemePalette { light: true }
property ThemePalette dark: ThemePalette { light: false }
/*!
A utility method for changing the alpha on colors. Returns a new object, and does not modify
the original color at all.
*/
function alpha(color, alpha) {
// Make sure we have a real color object to work with (versus a string like "#ccc")
var realColor = Qt.darker(color, 1)
realColor.a = alpha
return realColor
}
/*!
Select a color depending on whether the background is light or dark.
\c lightColor is the color used on a light background.
\c darkColor is the color used on a dark background.
*/
function lightDark(background, lightColor, darkColor) {
var temp = Qt.darker(background, 1)
var a = 1 - ( 0.299 * temp.r + 0.587 * temp.g + 0.114 * temp.b);
if (temp.a === 0 || a < 0.3)
return lightColor
else
return darkColor
}
FontLoader {source: Qt.resolvedUrl("fonts/opensans/OpenSans-Bold.ttf")}
FontLoader {source: Qt.resolvedUrl("fonts/opensans/OpenSans-BoldItalic.ttf")}
FontLoader {source: Qt.resolvedUrl("fonts/opensans/OpenSans-ExtraBold.ttf")}
FontLoader {source: Qt.resolvedUrl("fonts/opensans/OpenSans-ExtraBoldItalic.ttf")}
FontLoader {source: Qt.resolvedUrl("fonts/opensans/OpenSans-Italic.ttf")}
FontLoader {source: Qt.resolvedUrl("fonts/opensans/OpenSans-Light.ttf")}
FontLoader {source: Qt.resolvedUrl("fonts/opensans/OpenSans-LightItalic.ttf")}
FontLoader {source: Qt.resolvedUrl("fonts/opensans/OpenSans-Regular.ttf")}
FontLoader {source: Qt.resolvedUrl("fonts/opensans/OpenSans-Semibold.ttf")}
FontLoader {source: Qt.resolvedUrl("fonts/opensans/OpenSans-SemiboldItalic.ttf")}
}