refactor(settings): 改用常规关于选项卡并统一蓝色强调色

This commit is contained in:
2026-11-03 20:55:11 +08:00
parent 418fc360c6
commit 7bf8cfff19
15 changed files with 108 additions and 487 deletions
+2 -17
View File
@@ -16,21 +16,6 @@ extension AppAppearance {
}
}
extension AppearancePreferences {
var tintColor: Color {
switch accent {
case .system: .accentColor
case .blue: .blue
case .purple: .purple
case .teal: .teal
case .green: .green
case .orange: .orange
case .pink: .pink
case .custom: Color(red: red, green: green, blue: blue)
}
}
}
struct AppearanceStyle: ViewModifier {
let preferences: AppearancePreferences
var refreshContentOnChange = false
@@ -39,13 +24,13 @@ struct AppearanceStyle: ViewModifier {
private var scheme: ColorScheme { resolved == .dark ? .dark : .light }
func body(content: Content) -> some View {
content
// Settings split-view hosts can retain their previous native appearance.
// Settings native hosts can retain their previous native appearance.
// Keep state in the owning view, but replace the hosted subtree on a resolved theme change.
.id(refreshContentOnChange ? resolved : nil)
.background(WindowAppearanceBridge(choice: resolved))
.preferredColorScheme(scheme)
.environment(\.colorScheme, scheme)
.tint(preferences.tintColor)
.tint(.blue)
}
}
+5 -1
View File
@@ -11,6 +11,7 @@ struct IntervalControl: View {
var body: some View {
HStack(spacing: 3) {
TextField("sampling.seconds", text: $text)
.labelsHidden()
.textFieldStyle(.roundedBorder).multilineTextAlignment(.trailing)
.frame(width: 64).focused($focused)
.onChange(of: text) { _, value in
@@ -21,7 +22,10 @@ struct IntervalControl: View {
}
.onSubmit { commit() }
Text("sampling.unit").foregroundStyle(.secondary).fixedSize()
Stepper("sampling.interval", value: $milliseconds, in: range, step: step).labelsHidden().fixedSize()
Stepper("sampling.interval", value: Binding(get: { milliseconds }, set: {
milliseconds = $0
synchronize()
}), in: range, step: step).labelsHidden().fixedSize()
}
.font(.system(size: 11)).monospacedDigit().controlSize(.small)
.fixedSize(horizontal: true, vertical: false)