on xenial help sign in
Use symbolic names for the custom colors.
ab7b4cdMirco Müller
qml/Notifications/SwipeToAct.qml+16−13
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright (C) 2014-2015 Canonical, Ltd.
2+ * Copyright (C) 20014-2015 Canonical, Ltd.
3 *
3 *
4 * This program is free software; you can redistribute it and/or modify
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
5 * it under the terms of the GNU General Public License as published by
@@ -30,7 +30,10 @@ Item {
30 property string rightIconName
30 property string rightIconName
31 readonly property double sliderHeight: units.gu(8)
31 readonly property double sliderHeight: units.gu(8)
32 readonly property double gap: units.gu(1)
32 readonly property double gap: units.gu(1)
33− readonly property color sliderDefault: "#b2b2b2"
33+ readonly property color sliderMainColor: "#b2b2b2"
34+ readonly property color green: "#38b44a"
35+ readonly property color red: "#df382c"
36+ readonly property color sliderBGColor: "#f4f4f4"
34 readonly property double halfWay: mouseArea.drag.maximumX / 2
37 readonly property double halfWay: mouseArea.drag.maximumX / 2
35
38
36 // linearly interpolate between start- and end-color
39 // linearly interpolate between start- and end-color
@@ -54,14 +57,14 @@ Item {
54 id: row
57 id: row
55 width: parent.width
58 width: parent.width
56 height: sliderHeight
59 height: sliderHeight
57− color: "#f4f4f4"
60+ color: sliderBGColor
58
61
59 UbuntuShape {
62 UbuntuShape {
60 id: leftShape
63 id: leftShape
61 anchors.top: parent.top
64 anchors.top: parent.top
62 anchors.left: parent.left
65 anchors.left: parent.left
63 anchors.margins: gap
66 anchors.margins: gap
64− color: "#df382c" //UbuntuColors.red
67+ color: red
65
68
66 state: "normal"
69 state: "normal"
67 height: units.gu(6)
70 height: units.gu(6)
@@ -93,7 +96,7 @@ Item {
93 Icon {
96 Icon {
94 name: "back"
97 name: "back"
95 height: units.gu(2.5)
98 height: units.gu(2.5)
96− color: "#b2b2b2"
99+ color: sliderMainColor
97 UbuntuNumberAnimation on opacity {
100 UbuntuNumberAnimation on opacity {
98 from: .5
101 from: .5
99 to: 1
102 to: 1
@@ -105,7 +108,7 @@ Item {
105 Icon {
108 Icon {
106 name: "back"
109 name: "back"
107 height: units.gu(2.5)
110 height: units.gu(2.5)
108− color: "#b2b2b2"
111+ color: sliderMainColor
109 UbuntuNumberAnimation on opacity {
112 UbuntuNumberAnimation on opacity {
110 from: 1
113 from: 1
111 to: .5
114 to: .5
@@ -144,17 +147,17 @@ Item {
144 if (slider.x <= gap + leftShape.width)
147 if (slider.x <= gap + leftShape.width)
145 {
148 {
146 factor = (slider.x - gap) / leftShape.width
149 factor = (slider.x - gap) / leftShape.width
147− slider.color = interpolate(leftShape.color, sliderDefault, factor)
150+ slider.color = interpolate(leftShape.color, sliderMainColor, factor)
148 } else if (slider.x >= rightShape.x - slider.width) {
151 } else if (slider.x >= rightShape.x - slider.width) {
149 factor = (slider.x - rightShape.x + rightShape.width) / rightShape.width
152 factor = (slider.x - rightShape.x + rightShape.width) / rightShape.width
150− slider.color = interpolate(sliderDefault, rightShape.color, factor)
153+ slider.color = interpolate(sliderMainColor, rightShape.color, factor)
151 } else {
154 } else {
152− slider.color = "#b2b2b2"
155+ slider.color = sliderMainColor
153 }
156 }
154 }
157 }
155
158
156 z: 1
159 z: 1
157− color: "#b2b2b2"
160+ color: sliderMainColor
158 height: units.gu(6)
161 height: units.gu(6)
159 width: units.gu(6)
162 width: units.gu(6)
160 borderSource: "none"
163 borderSource: "none"
@@ -175,7 +178,7 @@ Item {
175 Icon {
178 Icon {
176 name: "next"
179 name: "next"
177 height: units.gu(2.5)
180 height: units.gu(2.5)
178− color: "#b2b2b2"
181+ color: sliderMainColor
179 UbuntuNumberAnimation on opacity {
182 UbuntuNumberAnimation on opacity {
180 from: 1
183 from: 1
181 to: .5
184 to: .5
@@ -187,7 +190,7 @@ Item {
187 Icon {
190 Icon {
188 name: "next"
191 name: "next"
189 height: units.gu(2.5)
192 height: units.gu(2.5)
190− color: "#b2b2b2"
193+ color: sliderMainColor
191 UbuntuNumberAnimation on opacity {
194 UbuntuNumberAnimation on opacity {
192 from: .5
195 from: .5
193 to: 1
196 to: 1
@@ -203,7 +206,7 @@ Item {
203 anchors.top: parent.top
206 anchors.top: parent.top
204 anchors.right: parent.right
207 anchors.right: parent.right
205 anchors.margins: gap
208 anchors.margins: gap
206− color: "#38b44a" // UbuntuColors.green
209+ color: green
207
210
208 state: "normal"
211 state: "normal"
209 height: units.gu(6)
212 height: units.gu(6)