fixed color crash
This commit is contained in:
@@ -23,6 +23,7 @@ struct PreferencesView: View {
|
||||
}
|
||||
}
|
||||
@EnvironmentObject private var sparkleUpdater: SparkleUpdater
|
||||
@Environment(\.colorScheme) private var colorScheme
|
||||
|
||||
@AppStorage("pingInterval") private var storedPingInterval: Int = 10
|
||||
@AppStorage("refreshInterval") private var storedRefreshInterval: Int = 60
|
||||
@@ -143,12 +144,39 @@ struct PreferencesView: View {
|
||||
}
|
||||
private func backgroundColor(for tab: Tab) -> Color {
|
||||
if selection == tab {
|
||||
return Color.accentColor
|
||||
return sidebarSelectionColor
|
||||
}
|
||||
if hoveredTab == tab {
|
||||
return Color.accentColor.opacity(0.2)
|
||||
return sidebarHoverColor
|
||||
}
|
||||
return sidebarBaseColor
|
||||
}
|
||||
|
||||
private var sidebarSelectionColor: Color {
|
||||
switch colorScheme {
|
||||
case .dark:
|
||||
return Color(red: 0.22, green: 0.45, blue: 0.88)
|
||||
default:
|
||||
return Color(red: 0.10, green: 0.39, blue: 0.90)
|
||||
}
|
||||
}
|
||||
|
||||
private var sidebarHoverColor: Color {
|
||||
switch colorScheme {
|
||||
case .dark:
|
||||
return Color(red: 0.20, green: 0.22, blue: 0.27)
|
||||
default:
|
||||
return Color(red: 0.87, green: 0.91, blue: 0.98)
|
||||
}
|
||||
}
|
||||
|
||||
private var sidebarBaseColor: Color {
|
||||
switch colorScheme {
|
||||
case .dark:
|
||||
return Color(red: 0.15, green: 0.16, blue: 0.19)
|
||||
default:
|
||||
return Color(red: 0.96, green: 0.97, blue: 0.99)
|
||||
}
|
||||
return Color.accentColor.opacity(0.08)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user