Debian Codegraph @

src/imports/Components/Themes/Ambiance/2.0/Palette.qml

raw
1 /*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
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 Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17 import QtQuick 2.4
18 import Lomiri.Components
19 import Lomiri.Components.Themes
20
21 Palette {
22 normal: AmbianceNormal {}
23
24 disabled: AmbianceNormal {
25 Component.onCompleted: {
26 // specific disabled colors
27 var diff = {
28 selection: Qt.rgba(LomiriColors.blue.r, LomiriColors.blue.g, LomiriColors.blue.b, 0.1),
29 positiveText: "#FFFFFF",
30 negativeText: "#FFFFFF",
31 activityText: "#FFFFFF",
32 focusText: "#FFFFFF",
33 position: "#00000000"
34 };
35 for (var p in normal) {
36 // skip objectName and all change signals
37 if (p === "objectName" || p.indexOf("Changed") > 0) continue;
38 disabled[p] = diff[p] || (
39 // if not specific, colors are 40% opaque normal
40 Qt.rgba(normal[p].r, normal[p].g, normal[p].b, normal[p].a * 0.4)
41 );
42 }
43 }
44 }
45
46 // selected differs from normal in background, base, foreground
47 selected: AmbianceSelected {}
48
49 // selected disabled differs from normal in background, base, foreground
50 selectedDisabled: AmbianceSelected {
51 Component.onCompleted: {
52 // specific selected-disabled colors
53 var diff = {
54 foreground: LomiriColors.porcelain,
55 selection: Qt.rgba(LomiriColors.blue.r, LomiriColors.blue.g, LomiriColors.blue.b, 0.1),
56 positiveText: "#FFFFFF",
57 negativeText: "#FFFFFF",
58 activityText: "#FFFFFF",
59 focus: LomiriColors.blue,
60 focusText: "#FFFFFF",
61 field: "#FFFFFF",
62 position: "#00000000"
63 };
64 for (var p in selected) {
65 // skip objectName and all change signals
66 if (p === "objectName" || p.indexOf("Changed") > 0) continue;
67 selectedDisabled[p] = diff[p] || (
68 // if not specific, colors are 40% opaque normal
69 Qt.rgba(selected[p].r, selected[p].g, selected[p].b, normal[p].a * 0.4)
70 );
71 }
72 }
73 }
74
75 highlighted: AmbianceNormal {
76 background: LomiriColors.silk
77 base: LomiriColors.ash
78 baseText: LomiriColors.jet
79 foreground: LomiriColors.silk
80 raised: LomiriColors.silk
81 raisedText: LomiriColors.inkstone
82 raisedSecondaryText: LomiriColors.ash
83 }
84
85 focused: AmbianceNormal {
86 background: Qt.rgba(LomiriColors.blue.r, LomiriColors.blue.g, LomiriColors.blue.b, 0.2)
87 }
88 }