mirror of
https://github.com/maxgoedjen/secretive.git
synced 2025-06-19 13:50:57 +00:00
Tweak hover
This commit is contained in:
parent
697fdfafe4
commit
9ae0ca781b
@ -16,15 +16,15 @@ struct ToolbarButtonStyle: ButtonStyle {
|
|||||||
self.lightColor = lightColor
|
self.lightColor = lightColor
|
||||||
self.darkColor = darkColor
|
self.darkColor = darkColor
|
||||||
}
|
}
|
||||||
|
|
||||||
private var backingColor: Color {
|
@available(macOS 26.0, *)
|
||||||
|
private var glassTint: Color {
|
||||||
if !hovering {
|
if !hovering {
|
||||||
colorScheme == .light ? lightColor : darkColor
|
colorScheme == .light ? lightColor : darkColor
|
||||||
} else {
|
} else {
|
||||||
colorScheme == .light ? .black.opacity(0.1) : .white.opacity(0.05)
|
colorScheme == .light ? lightColor.exposureAdjust(1) : darkColor.exposureAdjust(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Namespace var namespace
|
|
||||||
|
|
||||||
func makeBody(configuration: Configuration) -> some View {
|
func makeBody(configuration: Configuration) -> some View {
|
||||||
if #available(macOS 26.0, *) {
|
if #available(macOS 26.0, *) {
|
||||||
@ -32,11 +32,9 @@ struct ToolbarButtonStyle: ButtonStyle {
|
|||||||
.label
|
.label
|
||||||
.foregroundColor(.white)
|
.foregroundColor(.white)
|
||||||
.padding(EdgeInsets(top: 6, leading: 8, bottom: 6, trailing: 8))
|
.padding(EdgeInsets(top: 6, leading: 8, bottom: 6, trailing: 8))
|
||||||
.glassEffect(.regular.tint(backingColor), in: .capsule, isEnabled: true)
|
.glassEffect(.regular.tint(glassTint), in: .capsule, isEnabled: true)
|
||||||
.onHover { hovering in
|
.onHover { hovering in
|
||||||
withAnimation {
|
self.hovering = hovering
|
||||||
self.hovering = hovering
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
configuration
|
configuration
|
||||||
|
Loading…
Reference in New Issue
Block a user