2 * Copyright 2012 Canonical Ltd.
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.
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.
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/>.
18import Lomiri.Components 1.3
20// FIXME: copied with slight modifications from Lomiri UI Toolkit's Ambiance's theme
29 Color of the header's background.
31 \sa backgroundColor, footerColor
33 property color headerColor: styledItem.headerColor
36 Color of the background.
38 The background is usually a single color. However if \l headerColor
39 or \l footerColor are set then a gradient of colors will be drawn.
41 \sa footerColor, headerColor
43 property color backgroundColor: styledItem.backgroundColor
46 Color of the footer's background.
48 \sa backgroundColor, headerColor
50 property color footerColor: styledItem.footerColor
53 id: backgroundGradient
54 GradientStop { position: 0.0; color: mainViewStyle.headerColor }
55 GradientStop { position: 0.83; color: mainViewStyle.backgroundColor }
56 GradientStop { position: 1.0; color: mainViewStyle.footerColor }
62 color: mainViewStyle.backgroundColor
63 gradient: internals.isGradient ? backgroundGradient : null
68 property bool isGradient: mainViewStyle.backgroundColor != mainViewStyle.headerColor ||
69 mainViewStyle.backgroundColor != mainViewStyle.footerColor
72 As we don't know the order the property bindings and onXXXChanged signals are evaluated
73 we should rely only on one property when changing the theme to avoid intermediate
74 theme changes due to properties being evaluated separately.
76 Qt bug: https://bugreports.qt-project.org/browse/QTBUG-11712
78 property string theme: (ColorUtils.luminance(styledItem.backgroundColor) >= 0.85) ? "Ambiance" : "SuruDark"
81 // automatically select the appropriate theme depending on the background colors
84 restoreMode: Binding.RestoreBinding
86 value: internals.theme
87 when: internals.theme !== ""