Skip to content

Commit 5d13b53

Browse files
itscallsshdhhclaude
authored
Pin network overlay text to a fixed light palette so every theme stays legible (omacom#6529)
* fix(network): pin overlay text to a fixed on-scrim palette SpeedTestPanel and WifiQrPanel both draw over a hardcoded near-black scrim, but their text/tick colors came from bar.foreground -- a color themed to contrast with the *bar's* own background, which flips dark/light per theme. On themes with a dark bar.foreground, digits and labels went invisible against the black scrim, leaving only the accent-colored arc/needle (Color.accent) visible. Add a fixed white-based on-scrim palette (onScrim/onScrimDim) to both overlays and route all text/tick colors through it, independent of theme. bar.urgent stays theme-driven since it's a semantic color already legible on near-black. * Trim the on-scrim palette comments to the constraint Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * Pin overlay error text to a fixed on-scrim urgent color Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: David Heinemeier Hansson <david@hey.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent 75538f5 commit 5d13b53

2 files changed

Lines changed: 26 additions & 14 deletions

File tree

‎shell/plugins/panels/network/SpeedTestPanel.qml‎

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ PanelWindow {
3333
readonly property bool failed: error !== ""
3434
readonly property bool finished: !running && !failed && (downloadValue > 0 || uploadValue > 0)
3535

36+
// The scrim below is a fixed near-black regardless of theme, so text and
37+
// ticks on it need a fixed light palette, not the themed bar.foreground.
38+
readonly property color onScrim: "white"
39+
readonly property color onScrimDim: Qt.rgba(1, 1, 1, 0.55)
40+
readonly property color onScrimUrgent: "#ff6b6b"
41+
3642
function toMbps(raw) {
3743
var value = parseFloat(raw)
3844
return isFinite(value) && value > 0 ? value : 0
@@ -101,7 +107,7 @@ PanelWindow {
101107
Text {
102108
visible: root.connectionName !== ""
103109
text: root.connectionName.toUpperCase()
104-
color: Qt.darker(root.bar.foreground, 1.4)
110+
color: root.onScrimDim
105111
font.family: root.bar.fontFamily
106112
font.pixelSize: Style.font.caption
107113
font.bold: true
@@ -137,7 +143,7 @@ PanelWindow {
137143
bordered: true
138144
enabled: !root.running
139145
opacity: root.running ? 0 : 1
140-
foreground: root.bar.foreground
146+
foreground: root.onScrim
141147
fontFamily: root.bar.fontFamily
142148
fontSize: Style.font.bodySmall
143149
horizontalPadding: Style.space(14)
@@ -153,7 +159,7 @@ PanelWindow {
153159
Text {
154160
visible: root.failed
155161
text: root.error
156-
color: root.bar.urgent
162+
color: root.onScrimUrgent
157163
font.family: root.bar.fontFamily
158164
font.pixelSize: Style.font.bodySmall
159165
wrapMode: Text.Wrap
@@ -184,9 +190,9 @@ PanelWindow {
184190
readonly property int tickCount: 46
185191
readonly property real arcWidth: Style.space(4)
186192
readonly property real arcRadius: diameter / 2 - arcWidth
187-
readonly property color trackColor: Qt.rgba(root.bar.foreground.r, root.bar.foreground.g, root.bar.foreground.b, 0.14)
188-
readonly property color minorTickColor: Qt.rgba(root.bar.foreground.r, root.bar.foreground.g, root.bar.foreground.b, 0.12)
189-
readonly property color majorTickColor: Qt.rgba(root.bar.foreground.r, root.bar.foreground.g, root.bar.foreground.b, 0.3)
193+
readonly property color trackColor: Qt.rgba(1, 1, 1, 0.14)
194+
readonly property color minorTickColor: Qt.rgba(1, 1, 1, 0.12)
195+
readonly property color majorTickColor: Qt.rgba(1, 1, 1, 0.3)
190196
// The dial that isn't measuring yet sits dimmed until it gets a figure.
191197
readonly property bool engaged: live || value > 0
192198

@@ -361,7 +367,7 @@ PanelWindow {
361367
Text {
362368
anchors.horizontalCenter: parent.horizontalCenter
363369
text: dial.reading < 10 ? dial.reading.toFixed(1) : Math.round(dial.reading).toString()
364-
color: root.bar.foreground
370+
color: root.onScrim
365371
font.family: root.bar.fontFamily
366372
font.pixelSize: Style.font.display
367373
font.bold: true
@@ -370,7 +376,7 @@ PanelWindow {
370376
Text {
371377
anchors.horizontalCenter: parent.horizontalCenter
372378
text: "Mbps"
373-
color: Qt.darker(root.bar.foreground, 1.4)
379+
color: root.onScrimDim
374380
font.family: root.bar.fontFamily
375381
font.pixelSize: Style.font.caption
376382
}
@@ -382,7 +388,7 @@ PanelWindow {
382388
anchors.horizontalCenter: parent.horizontalCenter
383389
anchors.bottom: parent.bottom
384390
text: dial.label
385-
color: Qt.darker(root.bar.foreground, 1.3)
391+
color: root.onScrimDim
386392
font.family: root.bar.fontFamily
387393
font.pixelSize: Style.font.caption
388394
font.bold: true

‎shell/plugins/panels/network/WifiQrPanel.qml‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ PanelWindow {
2525

2626
readonly property bool showingQr: qrSize > 0 && !loading && error === ""
2727

28+
// The scrim below is a fixed near-black regardless of theme, so text on
29+
// it needs a fixed light palette, not the themed bar.foreground.
30+
readonly property color onScrim: "white"
31+
readonly property color onScrimDim: Qt.rgba(1, 1, 1, 0.55)
32+
readonly property color onScrimUrgent: "#ff6b6b"
33+
2834
signal closeRequested()
2935
signal passwordToggleRequested()
3036

@@ -84,7 +90,7 @@ PanelWindow {
8490

8591
Text {
8692
text: (root.ssid || "Wi-Fi").toUpperCase()
87-
color: Qt.darker(root.bar.foreground, 1.4)
93+
color: root.onScrimDim
8894
font.family: root.bar.fontFamily
8995
font.pixelSize: Style.font.caption
9096
font.bold: true
@@ -136,7 +142,7 @@ PanelWindow {
136142
Text {
137143
visible: root.loading
138144
text: "Generating QR code…"
139-
color: Qt.darker(root.bar.foreground, 1.3)
145+
color: root.onScrimDim
140146
font.family: root.bar.fontFamily
141147
font.pixelSize: Style.font.bodySmall
142148
Layout.fillWidth: true
@@ -146,7 +152,7 @@ PanelWindow {
146152
Text {
147153
visible: root.error !== ""
148154
text: root.error
149-
color: root.bar.urgent
155+
color: root.onScrimUrgent
150156
font.family: root.bar.fontFamily
151157
font.pixelSize: Style.font.bodySmall
152158
wrapMode: Text.Wrap
@@ -158,7 +164,7 @@ PanelWindow {
158164
Text {
159165
visible: root.showingQr
160166
text: "Scan to join this network"
161-
color: Qt.darker(root.bar.foreground, 1.3)
167+
color: root.onScrimDim
162168
font.family: root.bar.fontFamily
163169
font.pixelSize: Style.font.bodySmall
164170
Layout.fillWidth: true
@@ -170,7 +176,7 @@ PanelWindow {
170176
text: root.passwordError !== "" ? root.passwordError
171177
: root.passwordVisible ? root.password
172178
: "Show password"
173-
color: root.passwordError !== "" ? root.bar.urgent : root.bar.foreground
179+
color: root.passwordError !== "" ? root.onScrimUrgent : root.onScrim
174180
opacity: root.passwordVisible || root.passwordError !== "" ? 1 : 0.6
175181
font.family: root.bar.fontFamily
176182
font.pixelSize: Style.font.bodySmall

0 commit comments

Comments
 (0)