@@ -28,9 +28,7 @@ Item {
2828 readonly property alias headerHeight: header.height
2929
3030 property bool showHeader: true
31− property bool inOverlay: template["overlay"] === true
32− property bool useMascotShape: !(template && template["card-background"] !== undefined)
33− property color fontColor: getFontColor(background.color)
31+ readonly property bool inOverlay: template["overlay"] === true
3432
3533 implicitWidth: childrenRect.width
3634 implicitHeight: summary.y + summary.height + (summary.text && background.visible ? units.gu(1) : 0)
@@ -142,6 +140,7 @@ Item {
142140 CardHeader {
143141 id: header
144142 objectName: "cardHeader"
143+
145144 anchors {
146145 top: {
147146 if (template) {
@@ -164,8 +163,8 @@ Item {
164163 subtitle: cardData && cardData["subtitle"] || ""
165164
166165 opacity: showHeader ? 1 : 0
167− fontColor: root.fontColor
168− useMascotShape: root.useMascotShape
166+ fontColor: inOverlay ? "white" : summary.getFontColor(background.color)
167+ useMascotShape: background.visible
169168
170169 Behavior on opacity { NumberAnimation { duration: UbuntuAnimation.SnapDuration } }
171170 }
@@ -186,18 +185,17 @@ Item {
186185 text: cardData && cardData["summary"] || ""
187186 height: text ? implicitHeight : 0
188187 fontSize: "small"
189− color: fontColor
190− }
188+ color: getFontColor(background.color)
191189
192− function getLuminance(color) {
193− return 0.2126 * color.r + 0.7152 * color.g + 0.0722 * color.b;
194− }
190+ function getLuminance(color) {
191+ return 0.2126 * color.r + 0.7152 * color.g + 0.0722 * color.b;
192+ }
195193
196− // TODO karni: Change "grey" to Ubuntu.Components.Palette color once updated.
197− function getFontColor(backgroundColor) {
198− if (inOverlay) return "white";
199− if (backgroundColor === undefined) return "grey";
200− var luminance = getLuminance(backgroundColor);
201− return luminance < 0.7 ? "white" : "grey"
194+ // TODO karni: Change "grey" to Ubuntu.Components.Palette color once updated.
195+ function getFontColor(backgroundColor) {
196+ if (backgroundColor === undefined) return "grey";
197+ var luminance = getLuminance(backgroundColor);
198+ return luminance < 0.7 ? "white" : "grey"
199+ }
202200 }
203201}