Kirigami2

Material/Theme.qml
1 /*
2  * SPDX-FileCopyrightText: 2015 Marco Martin <[email protected]>
3  *
4  * SPDX-License-Identifier: LGPL-2.0-or-later
5  */
6 
7 import QtQuick 2.7
8 import QtQuick.Controls.Material 2.0
9 import org.kde.kirigami 2.16 as Kirigami
10 
11 /**
12  * \internal
13  */
14 Kirigami.BasicThemeDefinition {
15  id: theme
16  //NOTE: this is useless per se, but it forces the Material attached property to be created
17  Material.elevation:2
18 
19  textColor: theme.Material.foreground
20  disabledTextColor: "#9931363b"
21 
22  highlightColor: theme.Material.accent
23  //FIXME: something better?
24  highlightedTextColor: theme.Material.background
25  backgroundColor: theme.Material.background
26  alternateBackgroundColor: Qt.darker(theme.Material.background, 1.05)
27 
28  hoverColor: theme.Material.highlightedButtonColor
29  focusColor: theme.Material.highlightedButtonColor
30 
31  activeTextColor: theme.Material.primary
32  activeBackgroundColor: theme.Material.primary
33  linkColor: "#2980B9"
34  linkBackgroundColor: "#2980B9"
35  visitedLinkColor: "#7F8C8D"
36  visitedLinkBackgroundColor: "#7F8C8D"
37  negativeTextColor: "#DA4453"
38  negativeBackgroundColor: "#DA4453"
39  neutralTextColor: "#F67400"
40  neutralBackgroundColor: "#F67400"
41  positiveTextColor: "#27AE60"
42  positiveBackgroundColor: "#27AE60"
43 
44  buttonTextColor: theme.Material.foreground
45  buttonBackgroundColor: theme.Material.buttonColor
46  buttonAlternateBackgroundColor: Qt.darker(theme.Material.buttonColor, 1.05)
47  buttonHoverColor: theme.Material.highlightedButtonColor
48  buttonFocusColor: theme.Material.highlightedButtonColor
49 
50  viewTextColor: theme.Material.foreground
51  viewBackgroundColor: theme.Material.dialogColor
52  viewAlternateBackgroundColor: Qt.darker(theme.Material.dialogColor, 1.05)
53  viewHoverColor: theme.Material.listHighlightColor
54  viewFocusColor: theme.Material.listHighlightColor
55 
56  selectionTextColor: theme.Material.primaryHighlightedTextColor
57  selectionBackgroundColor: theme.Material.textSelectionColor
58  selectionAlternateBackgroundColor: Qt.darker(theme.Material.textSelectionColor, 1.05)
59  selectionHoverColor: theme.Material.highlightedButtonColor
60  selectionFocusColor: theme.Material.highlightedButtonColor
61 
62  tooltipTextColor: fontMetrics.Material.foreground
63  tooltipBackgroundColor: fontMetrics.Material.tooltipColor
64  tooltipAlternateBackgroundColor: Qt.darker(theme.Material.tooltipColor, 1.05)
65  tooltipHoverColor: fontMetrics.Material.highlightedButtonColor
66  tooltipFocusColor: fontMetrics.Material.highlightedButtonColor
67 
68  complementaryTextColor: fontMetrics.Material.foreground
69  complementaryBackgroundColor: fontMetrics.Material.background
70  complementaryAlternateBackgroundColor: Qt.lighter(fontMetrics.Material.background, 1.05)
71  complementaryHoverColor: theme.Material.highlightedButtonColor
72  complementaryFocusColor: theme.Material.highlightedButtonColor
73 
74  headerTextColor: fontMetrics.Material.primaryTextColor
75  headerBackgroundColor: fontMetrics.Material.primaryColor
76  headerAlternateBackgroundColor: Qt.lighter(fontMetrics.Material.primaryColor, 1.05)
77  headerHoverColor: theme.Material.highlightedButtonColor
78  headerFocusColor: theme.Material.highlightedButtonColor
79 
80  defaultFont: fontMetrics.font
81 
82  property list<QtObject> children: [
83  TextMetrics {
84  id: fontMetrics
85  //this is to get a source of dark colors
86  Material.theme: Material.Dark
87  }
88  ]
89 
90  onSync: {
91  //TODO: actually check if it's a dark or light color
92  if (object.Kirigami.Theme.colorSet === Kirigami.Theme.Complementary) {
93  object.Material.theme = Material.Dark
94  } else {
95  object.Material.theme = Material.Light
96  }
97 
98  object.Material.foreground = object.Kirigami.Theme.textColor
99  object.Material.background = object.Kirigami.Theme.backgroundColor
100  object.Material.primary = object.Kirigami.Theme.highlightColor
101  object.Material.accent = object.Kirigami.Theme.highlightColor
102  }
103 }
Definition: icon.h:18
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sun Jun 20 2021 22:38:04 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.