Warning, /plasma/qqc2-breeze-style/style/impl/Theme.qml is written in an unsupported language. File is not indexed.
0001 /* SPDX-FileCopyrightText: 2023 Devin Lin <devin@kd.org> 0002 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0003 */ 0004 0005 import QtQuick 0006 import org.kde.kirigami as Kirigami 0007 0008 pragma Singleton 0009 0010 QtObject { 0011 0012 // these are functions, not properties because we use Kirigami.Theme, which is context dependent 0013 function separatorColor() { 0014 switch (Kirigami.Theme.colorSet) { 0015 case Kirigami.Theme.Button: 0016 return separatorColorHelper(Kirigami.Theme.backgroundColor, Kirigami.Theme.textColor, 0.3); 0017 case Kirigami.Theme.Selection: 0018 return Kirigami.Theme.focusColor; 0019 default: 0020 return separatorColorHelper(Kirigami.Theme.backgroundColor, Kirigami.Theme.textColor, 0.2); 0021 } 0022 } 0023 0024 function buttonSeparatorColor() { 0025 return separatorColorHelper(Kirigami.Theme.backgroundColor, Kirigami.Theme.textColor, 0.3); 0026 } 0027 0028 function separatorColorHelper(bg, fg, baseRatio) { 0029 if (Kirigami.ColorUtils.brightnessForColor(bg) === Kirigami.ColorUtils.Light) { 0030 return Kirigami.ColorUtils.linearInterpolation(bg, fg, baseRatio); 0031 } else { 0032 return Kirigami.ColorUtils.linearInterpolation(bg, fg, baseRatio / 2); 0033 } 0034 } 0035 }