mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-06 05:25:41 -05:00
60 lines
1.7 KiB
QML
60 lines
1.7 KiB
QML
import QtQuick
|
|
import qs.Common
|
|
import qs.Widgets
|
|
|
|
Rectangle {
|
|
id: root
|
|
|
|
property bool isActive: false
|
|
property string section: "right"
|
|
property var popupTarget: null
|
|
property var parentScreen: null
|
|
property real widgetHeight: 30
|
|
property real barHeight: 48
|
|
readonly property real horizontalPadding: SettingsData.topBarNoBackground ? 0 : Math.max(Theme.spacingXS, Theme.spacingS * (widgetHeight / 30))
|
|
|
|
signal clicked()
|
|
|
|
width: colorPickerIcon.width + horizontalPadding * 2
|
|
height: widgetHeight
|
|
radius: SettingsData.topBarNoBackground ? 0 : Theme.cornerRadius
|
|
color: {
|
|
if (SettingsData.topBarNoBackground) {
|
|
return "transparent";
|
|
}
|
|
|
|
const baseColor = colorPickerArea.containsMouse || root.isActive ? Theme.primaryPressed : Theme.secondaryHover;
|
|
return Qt.rgba(baseColor.r, baseColor.g, baseColor.b, baseColor.a * Theme.widgetTransparency);
|
|
}
|
|
|
|
DankIcon {
|
|
id: colorPickerIcon
|
|
|
|
anchors.centerIn: parent
|
|
name: "palette"
|
|
size: Theme.iconSize - 6
|
|
color: colorPickerArea.containsMouse || root.isActive ? Theme.primary : Theme.surfaceText
|
|
}
|
|
|
|
MouseArea {
|
|
id: colorPickerArea
|
|
|
|
anchors.fill: parent
|
|
hoverEnabled: true
|
|
cursorShape: Qt.PointingHandCursor
|
|
onPressed: {
|
|
console.log("Color picker button clicked!")
|
|
root.colorPickerRequested();
|
|
}
|
|
}
|
|
|
|
// Signal to notify TopBar to open color picker
|
|
signal colorPickerRequested()
|
|
|
|
Behavior on color {
|
|
ColorAnimation {
|
|
duration: Theme.shortDuration
|
|
easing.type: Theme.standardEasing
|
|
}
|
|
}
|
|
} |