@@ -44,6 +44,8 @@ Item {
44 anchors.fill: parent
44 anchors.fill: parent
45 image: backgroundImage.source ? backgroundImage : null
45 image: backgroundImage.source ? backgroundImage : null
47+ property real luminance: 0.2126 * color.r + 0.7152 * color.g + 0.0722 * color.b
47 property Image backgroundImage: Image {
49 property Image backgroundImage: Image {
48 objectName: "backgroundImage"
50 objectName: "backgroundImage"
@@ -186,17 +188,7 @@ Item {
186 text: cardData && cardData["summary"] || ""
188 text: cardData && cardData["summary"] || ""
187 height: text ? implicitHeight : 0
189 height: text ? implicitHeight : 0
188 fontSize: "small"
190 fontSize: "small"
189− color: getFontColor(background.color)
191− function getLuminance(color) {
192− return 0.2126 * color.r + 0.7152 * color.g + 0.0722 * color.b;
195 // TODO karni: Change "grey" to Ubuntu.Components.Palette color once updated.
191 // TODO karni: Change "grey" to Ubuntu.Components.Palette color once updated.
196− function getFontColor(backgroundColor) {
197− if (backgroundColor === undefined) return "grey";
198− var luminance = getLuminance(backgroundColor);
199− return luminance < 0.7 ? "white" : "grey"
192+ color: background.visible && background.luminance < 0.7 ? "white" : "grey"