Kirigami2

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

KDE's Doxygen guidelines are available online.