2
* Copyright (C) 2013 Canonical, Ltd.
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
6
* the Free Software Foundation; version 3.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
function twoColorByIndex(index, total, colors) {
22
red = (colors.main.r * p * 2.0) + colors.start.r * (0.5 - p) * 2.0;
23
green = (colors.main.g * p * 2.0) + colors.start.g * (0.5 - p) * 2.0;
24
blue = (colors.main.b * p * 2.0) + colors.start.b * (0.5 - p) * 2.0;
26
red = colors.end.r * (p - 0.5) * 2.0 + colors.main.r * (1.0 - p) * 2.0;
27
green = colors.end.g * (p - 0.5) * 2.0 + colors.main.g * (1.0 - p) * 2.0;
28
blue = colors.end.b * (p - 0.5) * 2.0 + colors.main.b * (1.0 - p) * 2.0;
31
return Qt.rgba(red, green, blue, 1)