From 7a098edf72d838ac3de1da2729a1917a897b58a7 Mon Sep 17 00:00:00 2001 From: mlangkabel Date: Fri, 7 Aug 2026 19:52:51 +0200 Subject: [PATCH] mark the exit row of the controls panel red on its chips instead of its label --- src/ui/ControlsPanel.cpp | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/ui/ControlsPanel.cpp b/src/ui/ControlsPanel.cpp index 9cea8a2..ea14f4e 100644 --- a/src/ui/ControlsPanel.cpp +++ b/src/ui/ControlsPanel.cpp @@ -46,19 +46,20 @@ QWidget* makeRow(ControlAction action, const ControlContext& context, QWidget* p layout->setSpacing(4); // Every badge is rendered from the binding the resolver matches, so a chip cannot - // claim a key that does nothing (REQ-UI-CONTROLS-ACCURACY). + // claim a key that does nothing (REQ-UI-CONTROLS-ACCURACY). The chips of the row + // that leaves the mode are the ones marked, not its label (REQ-UI-CONTROLS-CARD). + const bool exitsMode = (action == ControlAction::ExitMode); const std::vector bindings = getControlActionBindings(action, context); for (const ControlBinding& binding : bindings) { QLabel* badge = new QLabel(getControlBindingBadge(binding), row); - badge->setObjectName(QStringLiteral("controlBadge")); + badge->setObjectName(exitsMode ? QStringLiteral("controlBadgeExit") + : QStringLiteral("controlBadge")); layout->addWidget(badge); } QLabel* label = new QLabel(getControlActionLabel(action, context), row); - label->setObjectName(action == ControlAction::ExitMode - ? QStringLiteral("controlLabelExit") - : QStringLiteral("controlLabel")); + label->setObjectName(QStringLiteral("controlLabel")); layout->addSpacing(4); layout->addWidget(label); layout->addStretch(1); @@ -100,9 +101,17 @@ ControlsPanel::ControlsPanel(const GameWorldView* view, QWidget* parent) "QLabel#controlBadge { border: 1px solid palette(mid); border-radius: 3px;" " padding: 1px 5px; font-family: monospace; color: palette(text); }" "QLabel#controlLabel { color: palette(text); }" - // The row that leaves the mode reads differently from the ones that act within - // it (REQ-UI-CONTROLS-CARD). - "QLabel#controlLabelExit { color: palette(bright-text); }" + // The row that leaves the mode is marked on its chips rather than its label + // (REQ-UI-CONTROLS-CARD): the label keeps the ordinary text color, so the row + // stays legible whatever the palette, and only the chips carry the warning. + // + // A literal red because there is no palette role for "destructive" -- the + // nearest, bright-text, is white by design, being meant for text over dark + // highlights, and was unreadable on this panel's chrome. This value reads on a + // light and a dark background alike. It is widget chrome, so like the rest of + // this stylesheet it is deliberately not a visuals.toml color. + "QLabel#controlBadgeExit { border: 1px solid #c0392b; border-radius: 3px;" + " padding: 1px 5px; font-family: monospace; color: #c0392b; }" "QLabel#controlCaption { color: palette(mid); }")); QVBoxLayout* outerLayout = new QVBoxLayout(this);