From eab9cf96ecfd7dface23cdfeba6616e5b0d9b540 Mon Sep 17 00:00:00 2001 From: ryanzhao Date: Wed, 27 Apr 2022 11:31:28 +1000 Subject: [PATCH] fix an issue where in dark mode the share button outline is in wrong colour --- SessionUIKit/Components/Button.swift | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/SessionUIKit/Components/Button.swift b/SessionUIKit/Components/Button.swift index adb45f592..a8f3606b7 100644 --- a/SessionUIKit/Components/Button.swift +++ b/SessionUIKit/Components/Button.swift @@ -70,7 +70,15 @@ public final class Button : UIButton { if heightConstraint == nil { heightConstraint = set(.height, to: height) } layer.cornerRadius = height / 2 backgroundColor = fillColor - layer.borderColor = borderColor.cgColor + if #available(iOS 13.0, *) { + layer.borderColor = borderColor + .resolvedColor( + // Note: This is needed for '.cgColor' to support dark mode + with: UITraitCollection(userInterfaceStyle: isDarkMode ? .dark : .light) + ).cgColor + } else { + layer.borderColor = borderColor.cgColor + } layer.borderWidth = 1 let fontSize = (size == .small) ? Values.smallFontSize : Values.mediumFontSize titleLabel!.font = .boldSystemFont(ofSize: fontSize)