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 <noreply@anthropic.com>
This commit is contained in:
1 parent
eb81d51c07
commit
476ad75ba4
2 files changed
+10
-2
No files matched your search
@@ -14,6 +14,8 @@ QtObject {
|
|||||||
property color accent: G.Theme.accentVivid
|
property color accent: G.Theme.accentVivid
|
||||||
property color urgent: G.Theme.urgent
|
property color urgent: G.Theme.urgent
|
||||||
property color muted: G.Theme.textSecondary
|
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.
|
// Kept for API compatibility; always empty here.
|
||||||
property var shellValues: ({})
|
property var shellValues: ({})
|
||||||
|
|||||||
@@ -76,6 +76,11 @@ BorderSurface {
|
|||||||
readonly property bool hot: mouseArea.containsMouse || hasCursor
|
readonly property bool hot: mouseArea.containsMouse || hasCursor
|
||||||
readonly property bool _showFocusRing: focusable && activeFocus
|
readonly property bool _showFocusRing: focusable && activeFocus
|
||||||
readonly property color _selectedColor: Style.selectedStateColor(root.foreground, root.accent)
|
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 _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 _focusBorderSpec: Border.controlSpec("focus", root.foreground, root.accent)
|
||||||
readonly property var _hoverBorderSpec: Border.controlSpec("hover-cursor", 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)
|
color: mouseArea.pressed ? Style.pressedFillFor(root.foreground, root.accent)
|
||||||
: _showFocusRing ? Style.focusFillFor(root.foreground, root.accent)
|
: _showFocusRing ? Style.focusFillFor(root.foreground, root.accent)
|
||||||
: hot ? Style.hoverFillFor(root.foreground, root.accent)
|
: hot ? Style.hoverFillFor(root.foreground, root.accent)
|
||||||
|
: _solidSelected ? Color.accent
|
||||||
: selected ? Style.selectedFillFor(root.foreground, root.accent)
|
: selected ? Style.selectedFillFor(root.foreground, root.accent)
|
||||||
: active ? Style.selectedFillFor(root.foreground, root.accent)
|
: active ? Style.selectedFillFor(root.foreground, root.accent)
|
||||||
: background
|
: background
|
||||||
@@ -161,7 +167,7 @@ BorderSurface {
|
|||||||
textFormat: Text.PlainText
|
textFormat: Text.PlainText
|
||||||
visible: root.iconText !== ""
|
visible: root.iconText !== ""
|
||||||
text: root.iconText
|
text: root.iconText
|
||||||
color: root.selected ? root._selectedColor : root.foreground
|
color: root._labelColor
|
||||||
font.family: root.fontFamily
|
font.family: root.fontFamily
|
||||||
font.pixelSize: root.iconSize
|
font.pixelSize: root.iconSize
|
||||||
rotation: root.iconSpinning ? 0 : root.iconRotation
|
rotation: root.iconSpinning ? 0 : root.iconRotation
|
||||||
@@ -181,7 +187,7 @@ BorderSurface {
|
|||||||
textFormat: Text.PlainText
|
textFormat: Text.PlainText
|
||||||
visible: root.text !== ""
|
visible: root.text !== ""
|
||||||
text: root.text
|
text: root.text
|
||||||
color: root.selected ? root._selectedColor : root.foreground
|
color: root._labelColor
|
||||||
font.family: root.fontFamily
|
font.family: root.fontFamily
|
||||||
font.pixelSize: root.fontSize
|
font.pixelSize: root.fontSize
|
||||||
font.bold: root.selected
|
font.bold: root.selected
|
||||||
|
|||||||
Reference in new issue
Block a user