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/>.
17 import Ubuntu.Components 1.3
19 // FIXME: copied with slight modifications from Ubuntu UI Toolkit's Ambiance's theme
28 Color of the header's background.
30 \sa backgroundColor, footerColor
32 property color headerColor: styledItem.headerColor
35 Color of the background.
37 The background is usually a single color. However if \l headerColor
38 or \l footerColor are set then a gradient of colors will be drawn.
40 \sa footerColor, headerColor
42 property color backgroundColor: styledItem.backgroundColor
45 Color of the footer's background.
47 \sa backgroundColor, headerColor
49 property color footerColor: styledItem.footerColor
52 id: backgroundGradient
53 GradientStop { position: 0.0; color: mainViewStyle.headerColor }
54 GradientStop { position: 0.83; color: mainViewStyle.backgroundColor }
55 GradientStop { position: 1.0; color: mainViewStyle.footerColor }
61 color: mainViewStyle.backgroundColor
62 gradient: internals.isGradient ? backgroundGradient : null
67 property bool isGradient: mainViewStyle.backgroundColor != mainViewStyle.headerColor ||
68 mainViewStyle.backgroundColor != mainViewStyle.footerColor
71 As we don't know the order the property bindings and onXXXChanged signals are evaluated
72 we should rely only on one property when changing the theme to avoid intermediate
73 theme changes due to properties being evaluated separately.
75 Qt bug: https://bugreports.qt-project.org/browse/QTBUG-11712
77 property string theme: (ColorUtils.luminance(styledItem.backgroundColor) >= 0.85) ? "Ambiance" : "SuruDark"
80 // automatically select the appropriate theme depending on the background colors
84 value: internals.theme
85 when: internals.theme !== ""