From e9d14c6cbff72645b4574f39352011a1b0ed82bd Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Thu, 26 Jan 2023 15:17:17 -0500 Subject: [PATCH] Tweak status card background color in dark mode --- Tusker/Views/Status/StatusCardView.swift | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Tusker/Views/Status/StatusCardView.swift b/Tusker/Views/Status/StatusCardView.swift index dd354ba4..5404f7f5 100644 --- a/Tusker/Views/Status/StatusCardView.swift +++ b/Tusker/Views/Status/StatusCardView.swift @@ -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