Tweak status card background color in dark mode

This commit is contained in:
Shadowfacts 2023-01-26 15:17:17 -05:00
parent 8fc915d6a0
commit e9d14c6cbf
1 changed files with 14 additions and 1 deletions

View File

@ -98,8 +98,8 @@ class StatusCardView: UIView {
hStack.spacing = 4
hStack.clipsToBounds = true
hStack.layer.borderWidth = 0.5
hStack.layer.borderColor = UIColor.lightGray.cgColor
hStack.backgroundColor = inactiveBackgroundColor
updateBorderColor()
addSubview(hStack)
@ -132,11 +132,24 @@ class StatusCardView: UIView {
NotificationCenter.default.addObserver(self, selector: #selector(updateUIForPreferences), name: .preferencesChanged, object: nil)
}
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection)
updateBorderColor()
}
override func layoutSubviews() {
super.layoutSubviews()
hStack.layer.cornerRadius = 0.1 * bounds.height
}
private func updateBorderColor() {
if traitCollection.userInterfaceStyle == .dark {
hStack.layer.borderColor = UIColor.darkGray.cgColor
} else {
hStack.layer.borderColor = UIColor.lightGray.cgColor
}
}
func updateUI(status: StatusMO) {
guard status.id != statusID else {
return