@@ -30,7 +30,9 @@ Item {
30 property real fontScale: 1.0
30 property real fontScale: 1.0
32 property alias headerAlignment: titleLabel.horizontalAlignment
32 property alias headerAlignment: titleLabel.horizontalAlignment
33+ property bool inOverlay: template["overlay"] === true
33 property bool hasBackground: template && template["card-background"] !== undefined
34 property bool hasBackground: template && template["card-background"] !== undefined
35+ property color fontColor: getFontColor(background.color)
35 visible: mascotImage.status === Image.Ready || title || price
37 visible: mascotImage.status === Image.Ready || title || price
36 height: row.height > 0 ? row.height + row.margins * 2 : 0
38 height: row.height > 0 ? row.height + row.margins * 2 : 0
@@ -90,7 +92,7 @@ Item {
90 maximumLineCount: 2
92 maximumLineCount: 2
91 fontSize: "small"
93 fontSize: "small"
92 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale)
94 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale)
93− color: template["overlay"] === true ? "white" : Theme.palette.selected.backgroundText
95+ color: fontColor
@@ -102,7 +104,7 @@ Item {
102 visible: titleLabel.text && text
104 visible: titleLabel.text && text
103 fontSize: "x-small"
105 fontSize: "x-small"
104 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale)
106 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale)
105− color: template["overlay"] === true ? "white" : Theme.palette.selected.backgroundText
107+ color: fontColor
@@ -123,7 +125,7 @@ Item {
123 width: parent.labelWidth
125 width: parent.labelWidth
124 elide: Text.ElideRight
126 elide: Text.ElideRight
125 font.weight: Font.DemiBold
127 font.weight: Font.DemiBold
126− color: Theme.palette.selected.foreground
128+ color: "#ff990000"
127 visible: text
129 visible: text
@@ -133,6 +135,8 @@ Item {
133 width: parent.labelWidth
135 width: parent.labelWidth
134 elide: Text.ElideRight
136 elide: Text.ElideRight
135 horizontalAlignment: parent.labels === 3 ? Text.AlignHCenter : Text.AlignRight
137 horizontalAlignment: parent.labels === 3 ? Text.AlignHCenter : Text.AlignRight
138+ font.strikeout: true
136 visible: text
140 visible: text
@@ -141,9 +145,22 @@ Item {
141 width: parent.labelWidth
145 width: parent.labelWidth
142 elide: Text.ElideRight
146 elide: Text.ElideRight
143 horizontalAlignment: Text.AlignRight
147 horizontalAlignment: Text.AlignRight
144 visible: text
149 visible: text
155+ function getLuminance(color) {
156+ return 0.2126 * color.r + 0.7152 * color.g + 0.0722 * color.b;
159+ // TODO karni: Change "grey" to Ubuntu.Components.Palette color once updated.
160+ function getFontColor(backgroundColor) {
161+ if (inOverlay) return "white";
162+ if (backgroundColor === undefined) return "grey";
163+ var luminance = getLuminance(backgroundColor);
164+ return luminance < 0.7 ? "white" : "grey"