From 1a362ef9556591acd63d1c4856e1144b7a270082 Mon Sep 17 00:00:00 2001 From: Max Goedjen Date: Sun, 18 Dec 2022 15:16:08 -0800 Subject: [PATCH] Tighten up light-scheme colors (#429) * Tighten up light-scheme colors * Tweak more * Little more --- Sources/Secretive/Views/CopyableView.swift | 23 ++++++++++------------ 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/Sources/Secretive/Views/CopyableView.swift b/Sources/Secretive/Views/CopyableView.swift index f7cd9e9..bb1733d 100644 --- a/Sources/Secretive/Views/CopyableView.swift +++ b/Sources/Secretive/Views/CopyableView.swift @@ -8,6 +8,7 @@ struct CopyableView: View { var text: String @State private var interactionState: InteractionState = .normal + @Environment(\.colorScheme) private var colorScheme var body: some View { VStack(alignment: .leading) { @@ -77,38 +78,32 @@ struct CopyableView: View { } var backgroundColor: Color { - let color: NSColor switch interactionState { case .normal: - color = .windowBackgroundColor + return colorScheme == .dark ? Color(white: 0.2) : Color(white: 0.885) case .hovering: - color = .unemphasizedSelectedContentBackgroundColor + return colorScheme == .dark ? Color(white: 0.275) : Color(white: 0.82) case .clicking: - color = .selectedContentBackgroundColor + return .accentColor } - return Color(color) } var primaryTextColor: Color { - let color: NSColor switch interactionState { case .normal, .hovering: - color = .textColor + return Color(.textColor) case .clicking: - color = .white + return .white } - return Color(color) } var secondaryTextColor: Color { - let color: NSColor switch interactionState { case .normal, .hovering: - color = .secondaryLabelColor + return Color(.secondaryLabelColor) case .clicking: - color = .white + return .white } - return Color(color) } func copy() { @@ -128,7 +123,9 @@ struct CopyableView_Previews: PreviewProvider { static var previews: some View { Group { CopyableView(title: "Title", image: Image(systemName: "figure.wave"), text: "Hello world.") + .padding() CopyableView(title: "Title", image: Image(systemName: "figure.wave"), text: "Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. ") + .padding() } } }