From 7dbbb89455fb03a335abefe809776e26768c6555 Mon Sep 17 00:00:00 2001 From: Damocles Date: Fri, 17 Apr 2026 18:10:48 +0200 Subject: [PATCH] add accentColor property to BarIcon and BarLabel for proper color propagation --- modules/BarIcon.qml | 5 +++-- modules/BarLabel.qml | 5 +++-- modules/IdleInhibitor.qml | 2 +- modules/PowerProfile.qml | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/modules/BarIcon.qml b/modules/BarIcon.qml index 4ea736d..3761453 100644 --- a/modules/BarIcon.qml +++ b/modules/BarIcon.qml @@ -7,6 +7,7 @@ Text { property string icon: "" property string tooltip: "" property string minIcon: "" + property color accentColor: parent?.accentColor ?? M.Theme.base05 property bool _hovered: false property string _displayIcon: icon property string _pendingIcon: "" @@ -41,7 +42,7 @@ Text { } width: minIcon ? Math.max(implicitWidth, _minIconMetrics.width) : implicitWidth horizontalAlignment: minIcon ? Text.AlignHCenter : Text.AlignLeft - color: parent?.accentColor ?? M.Theme.base05 + color: root.accentColor font.pixelSize: M.Theme.fontSize + 1 font.family: M.Theme.iconFontFamily verticalAlignment: Text.AlignVCenter @@ -60,7 +61,7 @@ Text { M.FlyoutState.text = root.tooltip; M.FlyoutState.itemX = root.mapToGlobal(root.width / 2, 0).x - (QsWindow.window?.screen?.x ?? 0); M.FlyoutState.screen = QsWindow.window?.screen ?? null; - M.FlyoutState.accentColor = parent?.accentColor ?? root.color; + M.FlyoutState.accentColor = root.accentColor; M.FlyoutState.visible = true; } else if (!hovered && root.tooltip !== "") { M.FlyoutState.visible = false; diff --git a/modules/BarLabel.qml b/modules/BarLabel.qml index 5d8ff03..50dba29 100644 --- a/modules/BarLabel.qml +++ b/modules/BarLabel.qml @@ -7,12 +7,13 @@ Text { property string label: "" property string tooltip: "" property string minText: "" + property color accentColor: parent?.accentColor ?? M.Theme.base05 property bool _hovered: false text: label width: minText ? Math.max(implicitWidth, _minMetrics.width) : implicitWidth horizontalAlignment: minText ? Text.AlignHCenter : Text.AlignLeft - color: parent?.accentColor ?? M.Theme.base05 + color: root.accentColor font.pixelSize: M.Theme.fontSize font.family: M.Theme.fontFamily verticalAlignment: Text.AlignVCenter @@ -31,7 +32,7 @@ Text { M.FlyoutState.text = root.tooltip; M.FlyoutState.itemX = root.mapToGlobal(root.width / 2, 0).x - (QsWindow.window?.screen?.x ?? 0); M.FlyoutState.screen = QsWindow.window?.screen ?? null; - M.FlyoutState.accentColor = parent?.accentColor ?? root.color; + M.FlyoutState.accentColor = root.accentColor; M.FlyoutState.visible = true; } else if (!hovered && root.tooltip !== "") { M.FlyoutState.visible = false; diff --git a/modules/IdleInhibitor.qml b/modules/IdleInhibitor.qml index 2bb4104..8abc880 100644 --- a/modules/IdleInhibitor.qml +++ b/modules/IdleInhibitor.qml @@ -5,7 +5,7 @@ import "." as M M.BarIcon { id: root - color: root.active ? M.Theme.base09 : (parent?.accentColor ?? M.Theme.base05) + color: root.active ? M.Theme.base09 : root.accentColor tooltip: { const parts = ["Idle inhibition: " + (root.active ? "active" : "inactive")]; if (root._inhibitors) diff --git a/modules/PowerProfile.qml b/modules/PowerProfile.qml index f7af01a..cb6fead 100644 --- a/modules/PowerProfile.qml +++ b/modules/PowerProfile.qml @@ -5,7 +5,7 @@ M.BarIcon { id: root tooltip: "Power profile: " + (M.PowerProfileService.profile || "unknown") - color: M.PowerProfileService.profile === "performance" ? M.Theme.base09 : M.PowerProfileService.profile === "power-saver" ? M.Theme.base0B : parent?.accentColor ?? M.Theme.base05 + color: M.PowerProfileService.profile === "performance" ? M.Theme.base09 : M.PowerProfileService.profile === "power-saver" ? M.Theme.base0B : root.accentColor icon: { if (M.PowerProfileService.profile === "performance")