Warning, /frameworks/kirigami/src/styles/Material/Theme.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  *  SPDX-FileCopyrightText: 2015 Marco Martin <mart@kde.org>
0003  *
0004  *  SPDX-License-Identifier: LGPL-2.0-or-later
0005  */
0006 
0007 import QtQuick
0008 import QtQuick.Controls.Material
0009 import org.kde.kirigami as Kirigami
0010 
0011 Kirigami.BasicThemeDefinition {
0012     textColor: Material.foreground
0013     disabledTextColor: Qt.alpha(Material.foreground, 0.6)
0014 
0015     highlightColor: Material.accent
0016     //FIXME: something better?
0017     highlightedTextColor: Material.background
0018     backgroundColor: Material.background
0019     alternateBackgroundColor: Qt.darker(Material.background, 1.05)
0020 
0021     hoverColor: Material.buttonColor(Material.theme, Material.background, Material.accent, true, false, true, false)
0022     focusColor: Material.buttonColor(Material.theme, Material.background, Material.accent, true, false, true, false)
0023 
0024     activeTextColor: Material.primary
0025     activeBackgroundColor: Material.primary
0026     linkColor: "#2980B9"
0027     linkBackgroundColor: "#2980B9"
0028     visitedLinkColor: "#7F8C8D"
0029     visitedLinkBackgroundColor: "#7F8C8D"
0030     negativeTextColor: "#DA4453"
0031     negativeBackgroundColor: "#DA4453"
0032     neutralTextColor: "#F67400"
0033     neutralBackgroundColor: "#F67400"
0034     positiveTextColor: "#27AE60"
0035     positiveBackgroundColor: "#27AE60"
0036 
0037     buttonTextColor: Material.foreground
0038     buttonBackgroundColor: Material.buttonColor(Material.theme, Material.background, Material.accent, true, false, false, false)
0039     buttonAlternateBackgroundColor: Qt.darker(Material.buttonColor, 1.05)
0040     buttonHoverColor: Material.buttonColor(Material.theme, Material.background, Material.accent, true, false, true, false)
0041     buttonFocusColor: Material.buttonColor(Material.theme, Material.background, Material.accent, true, false, true, false)
0042 
0043     viewTextColor: Material.foreground
0044     viewBackgroundColor: Material.dialogColor
0045     viewAlternateBackgroundColor: Qt.darker(Material.dialogColor, 1.05)
0046     viewHoverColor: Material.listHighlightColor
0047     viewFocusColor: Material.listHighlightColor
0048 
0049     selectionTextColor: Material.primaryHighlightedTextColor
0050     selectionBackgroundColor: Material.textSelectionColor
0051     selectionAlternateBackgroundColor: Qt.darker(Material.textSelectionColor, 1.05)
0052     selectionHoverColor: Material.buttonColor(Material.theme, Material.background, Material.accent, true, false, true, false)
0053     selectionFocusColor: Material.buttonColor(Material.theme, Material.background, Material.accent, true, false, true, false)
0054 
0055     tooltipTextColor: fontMetrics.Material.foreground
0056     tooltipBackgroundColor: fontMetrics.Material.tooltipColor
0057     tooltipAlternateBackgroundColor: Qt.darker(Material.tooltipColor, 1.05)
0058     tooltipHoverColor: fontMetrics.Material.buttonColor(Material.theme, Material.background, Material.accent, true, false, true, false)
0059     tooltipFocusColor: fontMetrics.Material.buttonColor(Material.theme, Material.background, Material.accent, true, false, true, false)
0060 
0061     complementaryTextColor: fontMetrics.Material.foreground
0062     complementaryBackgroundColor: fontMetrics.Material.background
0063     complementaryAlternateBackgroundColor: Qt.lighter(fontMetrics.Material.background, 1.05)
0064     complementaryHoverColor: Material.buttonColor(Material.theme, Material.background, Material.accent, true, false, true, false)
0065     complementaryFocusColor: Material.buttonColor(Material.theme, Material.background, Material.accent, true, false, true, false)
0066 
0067     headerTextColor: fontMetrics.Material.primaryTextColor
0068     headerBackgroundColor: fontMetrics.Material.primaryColor
0069     headerAlternateBackgroundColor: Qt.lighter(fontMetrics.Material.primaryColor, 1.05)
0070     headerHoverColor: Material.buttonColor(Material.theme, Material.background, Material.accent, true, false, true, false)
0071     headerFocusColor: Material.buttonColor(Material.theme, Material.background, Material.accent, true, false, true, false)
0072 
0073     defaultFont: fontMetrics.font
0074 
0075     property list<QtObject> children: [
0076         TextMetrics {
0077             id: fontMetrics
0078             //this is to get a source of dark colors
0079             Material.theme: Material.Dark
0080         }
0081     ]
0082 
0083     onSync: object => {
0084         //TODO: actually check if it's a dark or light color
0085         if (object.Kirigami.Theme.colorSet === Kirigami.Theme.Complementary) {
0086             object.Material.theme = Material.Dark
0087         } else {
0088             object.Material.theme = Material.Light
0089         }
0090 
0091         object.Material.foreground = object.Kirigami.Theme.textColor
0092         object.Material.background = object.Kirigami.Theme.backgroundColor
0093         object.Material.primary = object.Kirigami.Theme.highlightColor
0094         object.Material.accent = object.Kirigami.Theme.highlightColor
0095     }
0096 }