From 476ad75ba4d65e8b28f2fa91c081fb0432531133 Mon Sep 17 00:00:00 2001 From: mx Date: Thu, 26 Nov 2026 00:19:44 +0100 Subject: [PATCH] Make selected plugin buttons readable with light accents Omarchy's kit drew a selected button's label in the accent colour on an accent tint, which vanished with a light accent such as yellow. A resting selected button is now a solid accent pill with the theme's accent text, like glassMxrph's own segmented controls. Co-Authored-By: Claude Opus 5.5 --- quickshell/compat/omarchy/Commons/Color.qml | 2 ++ quickshell/compat/omarchy/Ui/Button.qml | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/quickshell/compat/omarchy/Commons/Color.qml b/quickshell/compat/omarchy/Commons/Color.qml index f732851..5b7812a 100644 --- a/quickshell/compat/omarchy/Commons/Color.qml +++ b/quickshell/compat/omarchy/Commons/Color.qml @@ -14,6 +14,8 @@ QtObject { property color accent: G.Theme.accentVivid property color urgent: G.Theme.urgent property color muted: G.Theme.textSecondary + // Readable text on a solid accent fill (dark on a light accent). + property color accentText: G.Theme.accentText // Kept for API compatibility; always empty here. property var shellValues: ({}) diff --git a/quickshell/compat/omarchy/Ui/Button.qml b/quickshell/compat/omarchy/Ui/Button.qml index 503f137..7503f33 100644 --- a/quickshell/compat/omarchy/Ui/Button.qml +++ b/quickshell/compat/omarchy/Ui/Button.qml @@ -76,6 +76,11 @@ BorderSurface { readonly property bool hot: mouseArea.containsMouse || hasCursor readonly property bool _showFocusRing: focusable && activeFocus readonly property color _selectedColor: Style.selectedStateColor(root.foreground, root.accent) + // glassMxrph: a resting selected button is a solid accent pill with the + // theme's accent text, like the shell's own segmented controls. Accent text + // on an accent tint was unreadable with light accents. + readonly property bool _solidSelected: selected && !hot && !mouseArea.pressed && !_showFocusRing && Qt.colorEqual(root.accent, Color.accent) + readonly property color _labelColor: _solidSelected ? Color.accentText : selected && !hot ? _selectedColor : root.foreground readonly property var _tooltipBorderSpec: Border.localOrSurfaceSpec("tooltip", "border", root.tooltipBorder, Color.tooltip.border, Math.max(1, Style.normalBorderWidth)) readonly property var _focusBorderSpec: Border.controlSpec("focus", root.foreground, root.accent) readonly property var _hoverBorderSpec: Border.controlSpec("hover-cursor", root.foreground, root.accent) @@ -111,6 +116,7 @@ BorderSurface { color: mouseArea.pressed ? Style.pressedFillFor(root.foreground, root.accent) : _showFocusRing ? Style.focusFillFor(root.foreground, root.accent) : hot ? Style.hoverFillFor(root.foreground, root.accent) + : _solidSelected ? Color.accent : selected ? Style.selectedFillFor(root.foreground, root.accent) : active ? Style.selectedFillFor(root.foreground, root.accent) : background @@ -161,7 +167,7 @@ BorderSurface { textFormat: Text.PlainText visible: root.iconText !== "" text: root.iconText - color: root.selected ? root._selectedColor : root.foreground + color: root._labelColor font.family: root.fontFamily font.pixelSize: root.iconSize rotation: root.iconSpinning ? 0 : root.iconRotation @@ -181,7 +187,7 @@ BorderSurface { textFormat: Text.PlainText visible: root.text !== "" text: root.text - color: root.selected ? root._selectedColor : root.foreground + color: root._labelColor font.family: root.fontFamily font.pixelSize: root.fontSize font.bold: root.selected