2 * Copyright 2014 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/>.
20/*! \brief Helper for processing scope customization options.
22 It will take the customizations object passed by the scope and
23 process it to provide the scope UI with data such as colors or
28 /// Style object passed from the scope
29 property var style: Object()
31 /// Color used for text and symbolic icons
32 readonly property color foreground: "foreground-color" in style ? style["foreground-color"] : d.defaultDark
34 /// Luminance of the foreground color
35 readonly property real foregroundLuminance: foreground ? Style.luminance(foreground) : Style.luminance(d.defaultDark)
37 /// Color used for the overall background
38 readonly property color background: "background-color" in style ? style["background-color"] : "#00f5f5f5"
40 /// Luminance of the background color
41 readonly property real backgroundLuminance: background ? Style.luminance(background) : Style.luminance(d.defaultLight)
43 /*! \brief Luminance threshold for switching between fore and background color
45 \note If background colour is not fully opaque, the defaultLightLuminance it's taken into account instead of it.
47 readonly property real threshold: background.a !== 1.0 ? (foregroundLuminance + d.defaultLightLuminance) / 2
48 : (foregroundLuminance + backgroundLuminance) / 2
50 /*! \brief The lighter of foreground and background colors
52 \note If background color is not fully opaque, it's not taken into account
53 and defaults to the theme-provided light color.
55 readonly property color light: {
56 if (background.a !== 1.0) return foregroundLuminance > d.defaultLightLuminance ? foreground : d.defaultLight;
57 return foregroundLuminance > backgroundLuminance ? foreground : background;
60 /*! \brief The darker of foreground and background colors
62 \note If background color is not fully opaque, it's not taken into account
63 and defaults to the theme-provided dark color.
65 readonly property color dark: {
66 if (background.a !== 1.0) return foregroundLuminance < d.defaultDarkLuminance ? foreground : d.defaultDark;
67 return foregroundLuminance < backgroundLuminance ? foreground : background;
70 /// Source of the logo image for the header
71 readonly property url headerLogo: "logo" in d.headerStyle ? d.headerStyle["logo"] : ""
73 /// Background style for the header
74 readonly property url headerBackground: "background" in d.headerStyle ? d.headerStyle["background"] : "color:///#f5f5f5"
76 /// Foreground color for the header
77 readonly property color headerForeground: "foreground-color" in d.headerStyle ? d.headerStyle["foreground-color"] : foreground
79 /// Color of the header divider
80 readonly property color headerDividerColor: "divider-color" in d.headerStyle ? d.headerStyle["divider-color"] : "#e0e0e0"
82 /// Background style for the navigation
83 readonly property url navigationBackground: "navigation-background" in d.headerStyle ? d.headerStyle["navigation-background"] : "color:///#f5f5f5"
85 /// Color of the primary preview button
86 readonly property color previewButtonColor: "preview-button-color" in style ? style["preview-button-color"] : Theme.palette.selected.foreground
89 property var d: QtObject {
90 // FIXME: should be taken from the theme
91 readonly property color defaultLight: "white"
92 readonly property color defaultDark: Theme.palette.normal.baseText
93 readonly property real defaultLightLuminance: Style.luminance(defaultLight)
94 readonly property real defaultDarkLuminance: Style.luminance(defaultDark)
96 readonly property var headerStyle: "page-header" in style ? style["page-header"] : { }
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list