diff --git a/Sources/Compound/BaseStyles/CompoundButtonStyle.swift b/Sources/Compound/BaseStyles/CompoundButtonStyle.swift index 784ab0a..4f7a760 100644 --- a/Sources/Compound/BaseStyles/CompoundButtonStyle.swift +++ b/Sources/Compound/BaseStyles/CompoundButtonStyle.swift @@ -107,12 +107,12 @@ public struct CompoundButtonStyle: ButtonStyle { .compositingGroup() .opacity(configuration.isPressed ? pressedOpacity : 1) } else { - Capsule().stroke(buttonColor(configuration: configuration)) + Capsule().stroke(strokeColor(configuration: configuration)) } case .primary: - Capsule().fill(buttonColor(configuration: configuration)) + Capsule().fill(fillColor(configuration: configuration)) case .secondary: - Capsule().stroke(buttonColor(configuration: configuration)) + Capsule().stroke(strokeColor(configuration: configuration)) case .plain: EmptyView() } @@ -127,7 +127,7 @@ public struct CompoundButtonStyle: ButtonStyle { } } - private func buttonColor(configuration: Self.Configuration) -> Color { + private func fillColor(configuration: Self.Configuration) -> Color { guard isEnabled else { return .compound.bgActionPrimaryDisabled } if configuration.role == .destructive { return .compound.bgCriticalPrimary.opacity(configuration.isPressed ? pressedOpacity : 1) @@ -136,6 +136,14 @@ public struct CompoundButtonStyle: ButtonStyle { } } + private func strokeColor(configuration: Self.Configuration) -> Color { + if configuration.role == .destructive { + return .compound.borderCriticalPrimary.opacity(configuration.isPressed ? pressedOpacity : 1) + } else { + return .compound.borderInteractiveSecondary.opacity(configuration.isPressed ? pressedOpacity : 1) + } + } + private func textColor(configuration: Configuration) -> Color { if kind == .primary { return .compound.textOnSolidPrimary diff --git a/Tests/CompoundTests/__Snapshots__ b/Tests/CompoundTests/__Snapshots__ index 0db6b30..202e614 160000 --- a/Tests/CompoundTests/__Snapshots__ +++ b/Tests/CompoundTests/__Snapshots__ @@ -1 +1 @@ -Subproject commit 0db6b30edba9c5c96484c4f3178e7e0d2f4bb43e +Subproject commit 202e61462e68a619cea06f7d257bbc98c9c80dc6