Farben einstellbar — und erst mal überhaupt eine Farbe

Das Grün, das überall auftauchte, war die System-Akzentfarbe: `.tint` und
`.accentColor` werden ohne eigene Angabe dorthin durchgereicht, und das
betraf alle Popovers und das ganze Einstellungsfenster. Die Notch-Widgets
dagegen benutzten Onyx' eigenes Blau. Zwei Farben, ungewollt.

Jetzt eine, und die ist einstellbar. Ein neuer Reiter „Farben": Akzentfarbe
mit sechs Vorschlägen und einem Knopf, der die Systemfarbe übernimmt, dazu
das Paar für Herunter- und Hochladen samt Tauschknopf.

Die Signalfarben bleiben fest und stehen nur zur Ansicht dort. Gelb heißt
Warnung, Rot heißt kritisch, Grün heißt in Ordnung — bei Temperatur, Akku,
Lüfter und Fehlern. Wer sie umstellen kann, kann ihre Bedeutung zerstören;
ein rotes „alles gut" liest niemand richtig. Sichtbar sind sie trotzdem,
sonst sucht man die Warnfarbe im Reiter und findet sie nirgends.

Umgesetzt über die Tokens statt über vierzig Fundstellen: `Onyx.Color.accent`
ist keine Konstante mehr, sondern liest bei jedem Zugriff aus `OnyxTheme`.
Damit merkt SwiftUI die Abhängigkeit und zeichnet neu, sobald die Farbe sich
ändert. Dazu ein `.tint` an den vier Wurzeln — Panel, Popovers, Einstellungen,
Einrichtung —, damit auch Haken, Regler und Auswahlfelder mitziehen.

Nebenbei die Beschriftung: „Je Programm" heißt jetzt „Programme". Großgesetzt
las sich das als englisches „J-E".

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Scarriffle
2026-08-13 23:24:40 +02:00
parent 7a3d2c1c39
commit 2aa60eedf9
20 changed files with 757 additions and 45 deletions

View File

@@ -199,7 +199,7 @@
"de": {
"stringUnit": {
"state": "translated",
"value": "Je Programm"
"value": "Programme"
}
},
"en": {

View File

@@ -1,5 +1,6 @@
import SwiftUI
import MetricsProvider
import OnyxDesign
import OnyxMenuBar
@MainActor
@@ -9,9 +10,9 @@ struct NetworkPopoverContent: View {
var body: some View {
VStack(alignment: .leading, spacing: 12) {
HStack(alignment: .top) {
rate(model.snapshot.downloadRate, "network.download", .green)
rate(model.snapshot.downloadRate, "network.download", Onyx.Color.download)
Spacer()
rate(model.snapshot.uploadRate, "network.upload", .pink)
rate(model.snapshot.uploadRate, "network.upload", Onyx.Color.upload)
}
TrafficChart(history: model.history)
@@ -91,9 +92,11 @@ struct NetworkPopoverContent: View {
Text(process.name).font(.callout).lineLimit(1)
Spacer(minLength: 8)
Text(Throughput.formatted(process.downloadRate))
.font(.caption.monospacedDigit()).foregroundStyle(.green)
.font(.caption.monospacedDigit())
.foregroundStyle(Onyx.Color.download)
Text(Throughput.formatted(process.uploadRate))
.font(.caption.monospacedDigit()).foregroundStyle(.pink)
.font(.caption.monospacedDigit())
.foregroundStyle(Onyx.Color.upload)
}
}
}
@@ -134,7 +137,7 @@ struct NetworkPopoverContent: View {
private func section(_ key: LocalizedStringKey) -> some View {
Text(key, bundle: .module)
.font(.caption.weight(.semibold))
.foregroundStyle(.tint)
.foregroundStyle(Onyx.Color.accent)
.textCase(.uppercase)
}
@@ -183,11 +186,11 @@ private struct TrafficChart: View {
ForEach(Array(points.enumerated()), id: \.offset) { _, snapshot in
VStack(spacing: 1) {
Rectangle()
.fill(.pink)
.fill(Onyx.Color.upload)
.frame(height: max(half * CGFloat(snapshot.uploadRate / peak), 0.5))
.frame(maxHeight: .infinity, alignment: .bottom)
Rectangle()
.fill(.green)
.fill(Onyx.Color.download)
.frame(height: max(half * CGFloat(snapshot.downloadRate / peak), 0.5))
.frame(maxHeight: .infinity, alignment: .top)
}

View File

@@ -145,7 +145,7 @@ private struct NetworkWidgetView: View {
HStack(spacing: 6) {
Image(systemName: model.snapshot.interfaceKind.symbolName)
.font(.system(size: 11))
.foregroundStyle(Onyx.Color.accent)
.foregroundStyle(Onyx.Color.download)
Text(connectionName)
.font(Onyx.Font.caption)
.foregroundStyle(Onyx.Color.textSecondary)
@@ -154,7 +154,7 @@ private struct NetworkWidgetView: View {
Rates(snapshot: model.snapshot, compact: false)
Sparkline(values: model.series(download: true), tint: Onyx.Color.accent,
Sparkline(values: model.series(download: true), tint: Onyx.Color.download,
capacity: NetworkModel.historyLength)
.frame(height: 18)
@@ -190,8 +190,8 @@ private struct Rates: View {
var body: some View {
VStack(alignment: .leading, spacing: 1) {
row("arrow.down", Throughput.formatted(snapshot.downloadRate), Onyx.Color.accent)
row("arrow.up", Throughput.formatted(snapshot.uploadRate), Onyx.Color.positive)
row("arrow.down", Throughput.formatted(snapshot.downloadRate), Onyx.Color.download)
row("arrow.up", Throughput.formatted(snapshot.uploadRate), Onyx.Color.upload)
}
}