28 property var style: Object()
34 function luminance(color) {
35 return 0.2126 * color.r + 0.7152 * color.g + 0.0722 * color.b;
39 readonly
property color foreground:
"foreground-color" in style ? style[
"foreground-color"] : d.defaultDark
42 readonly
property color background:
"background-color" in style ? style[
"background-color"] :
"transparent"
48 readonly
property real threshold: background.a !== 1.0 ? d.foregroundLuminance : (d.foregroundLuminance + d.backgroundLuminance) / 2
55 readonly property color light: {
56 if (background.a !== 1.0)
return d.foregroundLuminance > d.defaultLightLuminance ? foreground : d.defaultLight;
57 return d.foregroundLuminance > d.backgroundLuminance ? foreground : background;
65 readonly
property color dark: {
66 if (background.a !== 1.0)
return d.foregroundLuminance < d.defaultDarkLuminance ? foreground : d.defaultDark;
67 return d.foregroundLuminance < d.backgroundLuminance ? foreground : background;
71 readonly
property url headerLogo:
"logo" in d.headerStyle ? d.headerStyle[
"logo"] :
""
74 property var d: QtObject {
75 readonly
property real foregroundLuminance: luminance(foreground)
76 readonly property real backgroundLuminance: luminance(background)
79 readonly property color defaultLight: "white"
80 readonly property color defaultDark: "grey"
81 readonly property real defaultLightLuminance: luminance(defaultLight)
82 readonly property real defaultDarkLuminance: luminance(defaultDark)
84 readonly property var headerStyle: "page-header" in style ? style["page-header"] : { }