From 3c4688bdb622bcc64c2e7c289639ba56f04db269 Mon Sep 17 00:00:00 2001 From: Malte Langkabel Date: Fri, 7 Aug 2026 19:47:56 +0200 Subject: [PATCH] mark the exit row on its chips instead of its label The label was painted palette(bright-text), which is not a destructive color at all: Qt has no such role, and bright-text is white by design, meant for text over dark highlights. On this panel's light chrome it was white on grey. The chips carry the warning now and the label keeps the ordinary text color, so the row stays legible whatever the palette and only the binding is marked -- which is what REQ-UI-CONTROLS-CARD asked for in the first place, and what the mockup shows. The red is a literal because no palette role means it, chosen to read on a light and a dark background alike, and it is widget chrome, so like the rest of this stylesheet it is deliberately not a visuals.toml color. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01YHcUerKAZKWNvSKJxYKbnG --- 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);